Skip to content

Commit 3db8331

Browse files
committed
fix(go-gitea#33711): cross-publish docker images to ghcr.io
1 parent 8ca51ab commit 3db8331

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.github/workflows/release-nightly.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
go-version-file: go.mod
7070
check-latest: true
7171
- uses: docker/setup-qemu-action@v3
72+
- uses: oras-project/setup-oras@v1
7273
- uses: docker/setup-buildx-action@v3
7374
- name: Get cleaned branch name
7475
id: clean_name
@@ -85,6 +86,12 @@ jobs:
8586
with:
8687
username: ${{ secrets.DOCKERHUB_USERNAME }}
8788
password: ${{ secrets.DOCKERHUB_TOKEN }}
89+
- name: Login to GHCR using PAT
90+
uses: docker/login-action@v3
91+
with:
92+
registry: ghcr.io
93+
username: ${{ github.repository_owner }}
94+
password: ${{ secrets.GITHUB_TOKEN }}
8895
- name: fetch go modules
8996
run: make vendor
9097
- name: build rootful docker image
@@ -94,6 +101,10 @@ jobs:
94101
platforms: linux/amd64,linux/arm64
95102
push: true
96103
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
104+
- name: copy rootful docker image to ghcr.io
105+
# this will also copy both the amd64 and arm64 versions at the same time
106+
run: |-
107+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}
97108
nightly-docker-rootless:
98109
runs-on: namespace-profile-gitea-release-docker
99110
steps:
@@ -106,6 +117,7 @@ jobs:
106117
go-version-file: go.mod
107118
check-latest: true
108119
- uses: docker/setup-qemu-action@v3
120+
- uses: oras-project/setup-oras@v1
109121
- uses: docker/setup-buildx-action@v3
110122
- name: Get cleaned branch name
111123
id: clean_name
@@ -122,6 +134,12 @@ jobs:
122134
with:
123135
username: ${{ secrets.DOCKERHUB_USERNAME }}
124136
password: ${{ secrets.DOCKERHUB_TOKEN }}
137+
- name: Login to GHCR using PAT
138+
uses: docker/login-action@v3
139+
with:
140+
registry: ghcr.io
141+
username: ${{ github.repository_owner }}
142+
password: ${{ secrets.GITHUB_TOKEN }}
125143
- name: fetch go modules
126144
run: make vendor
127145
- name: build rootless docker image
@@ -132,3 +150,7 @@ jobs:
132150
push: true
133151
file: Dockerfile.rootless
134152
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless
153+
- name: copy rootful docker image to ghcr.io
154+
# this will also copy both the amd64 and arm64 versions at the same time
155+
run: |-
156+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}

.github/workflows/release-tag-rc.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
- run: git fetch --unshallow --quiet --tags --force
7777
- uses: docker/setup-qemu-action@v3
7878
- uses: docker/setup-buildx-action@v3
79+
- uses: oras-project/setup-oras@v1
7980
- uses: docker/metadata-action@v5
8081
id: meta
8182
with:
@@ -90,6 +91,12 @@ jobs:
9091
with:
9192
username: ${{ secrets.DOCKERHUB_USERNAME }}
9293
password: ${{ secrets.DOCKERHUB_TOKEN }}
94+
- name: Login to GHCR using PAT
95+
uses: docker/login-action@v3
96+
with:
97+
registry: ghcr.io
98+
username: ${{ github.repository_owner }}
99+
password: ${{ secrets.GITHUB_TOKEN }}
93100
- name: build rootful docker image
94101
uses: docker/build-push-action@v5
95102
with:
@@ -98,6 +105,10 @@ jobs:
98105
push: true
99106
tags: ${{ steps.meta.outputs.tags }}
100107
labels: ${{ steps.meta.outputs.labels }}
108+
- name: copy rootful docker image to ghcr.io
109+
# this will also copy both the amd64 and arm64 versions at the same time
110+
run: |-
111+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}
101112
docker-rootless:
102113
runs-on: namespace-profile-gitea-release-docker
103114
steps:
@@ -107,6 +118,7 @@ jobs:
107118
- run: git fetch --unshallow --quiet --tags --force
108119
- uses: docker/setup-qemu-action@v3
109120
- uses: docker/setup-buildx-action@v3
121+
- uses: oras-project/setup-oras@v1
110122
- uses: docker/metadata-action@v5
111123
id: meta
112124
with:
@@ -123,6 +135,12 @@ jobs:
123135
with:
124136
username: ${{ secrets.DOCKERHUB_USERNAME }}
125137
password: ${{ secrets.DOCKERHUB_TOKEN }}
138+
- name: Login to GHCR using PAT
139+
uses: docker/login-action@v3
140+
with:
141+
registry: ghcr.io
142+
username: ${{ github.repository_owner }}
143+
password: ${{ secrets.GITHUB_TOKEN }}
126144
- name: build rootless docker image
127145
uses: docker/build-push-action@v5
128146
with:
@@ -132,3 +150,7 @@ jobs:
132150
file: Dockerfile.rootless
133151
tags: ${{ steps.meta.outputs.tags }}
134152
labels: ${{ steps.meta.outputs.labels }}
153+
- name: copy rootful docker image to ghcr.io
154+
# this will also copy both the amd64 and arm64 versions at the same time
155+
run: |-
156+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}

.github/workflows/release-tag-version.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
- run: git fetch --unshallow --quiet --tags --force
7979
- uses: docker/setup-qemu-action@v3
8080
- uses: docker/setup-buildx-action@v3
81+
- uses: oras-project/setup-oras@v1
8182
- uses: docker/metadata-action@v5
8283
id: meta
8384
with:
@@ -96,6 +97,12 @@ jobs:
9697
with:
9798
username: ${{ secrets.DOCKERHUB_USERNAME }}
9899
password: ${{ secrets.DOCKERHUB_TOKEN }}
100+
- name: Login to GHCR using PAT
101+
uses: docker/login-action@v3
102+
with:
103+
registry: ghcr.io
104+
username: ${{ github.repository_owner }}
105+
password: ${{ secrets.GITHUB_TOKEN }}
99106
- name: build rootful docker image
100107
uses: docker/build-push-action@v5
101108
with:
@@ -104,6 +111,10 @@ jobs:
104111
push: true
105112
tags: ${{ steps.meta.outputs.tags }}
106113
labels: ${{ steps.meta.outputs.labels }}
114+
- name: copy rootful docker image to ghcr.io
115+
# this will also copy both the amd64 and arm64 versions at the same time
116+
run: |-
117+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}
107118
docker-rootless:
108119
runs-on: namespace-profile-gitea-release-docker
109120
steps:
@@ -113,6 +124,7 @@ jobs:
113124
- run: git fetch --unshallow --quiet --tags --force
114125
- uses: docker/setup-qemu-action@v3
115126
- uses: docker/setup-buildx-action@v3
127+
- uses: oras-project/setup-oras@v1
116128
- uses: docker/metadata-action@v5
117129
id: meta
118130
with:
@@ -134,6 +146,12 @@ jobs:
134146
with:
135147
username: ${{ secrets.DOCKERHUB_USERNAME }}
136148
password: ${{ secrets.DOCKERHUB_TOKEN }}
149+
- name: Login to GHCR using PAT
150+
uses: docker/login-action@v3
151+
with:
152+
registry: ghcr.io
153+
username: ${{ github.repository_owner }}
154+
password: ${{ secrets.GITHUB_TOKEN }}
137155
- name: build rootless docker image
138156
uses: docker/build-push-action@v5
139157
with:
@@ -143,3 +161,7 @@ jobs:
143161
file: Dockerfile.rootless
144162
tags: ${{ steps.meta.outputs.tags }}
145163
labels: ${{ steps.meta.outputs.labels }}
164+
- name: copy rootful docker image to ghcr.io
165+
# this will also copy both the amd64 and arm64 versions at the same time
166+
run: |-
167+
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)