Skip to content

Commit cea09b3

Browse files
Add dedicated ci workflow for ghcr
Having them in one bundle causes intermittent errors. Until it is resolved we need to have the two separate.
1 parent 1f0dfd1 commit cea09b3

File tree

2 files changed

+131
-10
lines changed

2 files changed

+131
-10
lines changed

.github/workflows/ci-ghcr.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "v*.*.*"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
platform:
18+
- linux/amd64
19+
- linux/arm/v6
20+
- linux/arm/v7
21+
- linux/arm64
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set Environment Variables
28+
run: |
29+
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
30+
echo "VCS_REF=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
31+
32+
- name: Docker meta
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: |
37+
ghcr.io/${{ github.repository_owner }}/docker-nginx-http3
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to GitHub Container Registry
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.repository_owner }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Docker build and push
54+
id: build
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
platforms: ${{ matrix.platform }}
59+
push: ${{ github.event_name != 'pull_request' }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
tags: ${{ steps.meta.outputs.tags }}
62+
build-args: |
63+
BUILD_DATE=${{ env.BUILD_DATE }}
64+
VCS_REF=${{ env.VCS_REF }}
65+
GITHUB_REF=${{ github.ref }}
66+
GITHUB_RUN_ID=${{ github.run_id }}
67+
GITHUB_RUN_NUMBER=${{ github.run_number }}
68+
GITHUB_RUN_ATTEMPT=${{ github.run_attempt }}
69+
70+
- name: Export digest
71+
run: |
72+
mkdir -p /tmp/digests
73+
digest="${{ steps.build.outputs.digest }}"
74+
touch "/tmp/digests/${digest#sha256:}"
75+
76+
- name: Upload digest
77+
uses: actions/upload-artifact@v3
78+
with:
79+
name: digests
80+
path: /tmp/digests/*
81+
if-no-files-found: error
82+
retention-days: 1
83+
84+
merge:
85+
runs-on: ubuntu-latest
86+
needs:
87+
- build
88+
steps:
89+
- name: Download digests
90+
uses: actions/download-artifact@v3
91+
with:
92+
name: digests
93+
path: /tmp/digests
94+
95+
- name: Set up Docker Buildx
96+
uses: docker/setup-buildx-action@v3
97+
98+
- name: Docker meta
99+
id: meta
100+
uses: docker/metadata-action@v5
101+
with:
102+
images: |
103+
ghcr.io/${{ github.repository_owner }}/docker-nginx-http3
104+
tags: |
105+
type=schedule
106+
type=ref,event=branch
107+
type=ref,event=tag
108+
type=semver,pattern={{version}}
109+
type=semver,pattern={{major}}.{{minor}}
110+
type=semver,pattern={{major}}
111+
type=sha,prefix=
112+
type=sha,prefix=,format=long
113+
114+
- name: Login to GitHub Container Registry
115+
if: github.event_name != 'pull_request'
116+
uses: docker/login-action@v3
117+
with:
118+
registry: ghcr.io
119+
username: ${{ github.repository_owner }}
120+
password: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Create manifest list and push
123+
if: github.event_name != 'pull_request'
124+
working-directory: /tmp/digests
125+
run: |
126+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
127+
$(printf 'ghcr.io/${{ github.repository_owner }}/docker-nginx-http3@sha256:%s ' *)
128+
129+
- name: Inspect images
130+
run: |
131+
docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/docker-nginx-http3:${{ steps.meta.outputs.version }}

.github/workflows/ci.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ jobs:
100100
with:
101101
images: |
102102
${{ secrets.DOCKERHUB_USERNAME }}/docker-nginx-http3
103-
ghcr.io/${{ github.repository_owner }}/docker-nginx-http3
104103
tags: |
105104
type=schedule
106105
type=ref,event=branch
@@ -118,14 +117,6 @@ jobs:
118117
username: ${{ secrets.DOCKERHUB_USERNAME }}
119118
password: ${{ secrets.DOCKERHUB_PASSWORD }}
120119

121-
- name: Login to GitHub Container Registry
122-
if: github.event_name != 'pull_request'
123-
uses: docker/login-action@v3
124-
with:
125-
registry: ghcr.io
126-
username: ${{ github.repository_owner }}
127-
password: ${{ secrets.GITHUB_TOKEN }}
128-
129120
- name: Create manifest list and push
130121
if: github.event_name != 'pull_request'
131122
working-directory: /tmp/digests
@@ -136,4 +127,3 @@ jobs:
136127
- name: Inspect images
137128
run: |
138129
docker buildx imagetools inspect ${{ secrets.DOCKERHUB_USERNAME }}/docker-nginx-http3:${{ steps.meta.outputs.version }}
139-
docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/docker-nginx-http3:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)