Skip to content

Commit dc5adce

Browse files
authored
fix(#33711): cross-publish docker images to ghcr.io (#34148) (#34176)
1 parent 328ce04 commit dc5adce

File tree

3 files changed

+66
-6
lines changed

3 files changed

+66
-6
lines changed

.github/workflows/release-nightly.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
6060
nightly-docker-rootful:
6161
runs-on: namespace-profile-gitea-release-docker
62+
permissions:
63+
packages: write # to publish to ghcr.io
6264
steps:
6365
- uses: actions/checkout@v4
6466
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -85,6 +87,12 @@ jobs:
8587
with:
8688
username: ${{ secrets.DOCKERHUB_USERNAME }}
8789
password: ${{ secrets.DOCKERHUB_TOKEN }}
90+
- name: Login to GHCR using PAT
91+
uses: docker/login-action@v3
92+
with:
93+
registry: ghcr.io
94+
username: ${{ github.repository_owner }}
95+
password: ${{ secrets.GITHUB_TOKEN }}
8896
- name: fetch go modules
8997
run: make vendor
9098
- name: build rootful docker image
@@ -93,9 +101,13 @@ jobs:
93101
context: .
94102
platforms: linux/amd64,linux/arm64
95103
push: true
96-
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
104+
tags: |-
105+
gitea/gitea:${{ steps.clean_name.outputs.branch }}
106+
ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }}
97107
nightly-docker-rootless:
98108
runs-on: namespace-profile-gitea-release-docker
109+
permissions:
110+
packages: write # to publish to ghcr.io
99111
steps:
100112
- uses: actions/checkout@v4
101113
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -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
@@ -131,4 +149,6 @@ jobs:
131149
platforms: linux/amd64,linux/arm64
132150
push: true
133151
file: Dockerfile.rootless
134-
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless
152+
tags: |-
153+
gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless
154+
ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ jobs:
6969
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
7070
docker-rootful:
7171
runs-on: namespace-profile-gitea-release-docker
72+
permissions:
73+
packages: write # to publish to ghcr.io
7274
steps:
7375
- uses: actions/checkout@v4
7476
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -79,7 +81,9 @@ jobs:
7981
- uses: docker/metadata-action@v5
8082
id: meta
8183
with:
82-
images: gitea/gitea
84+
images: |-
85+
gitea/gitea
86+
ghcr.io/go-gitea/gitea
8387
flavor: |
8488
latest=false
8589
# 1.2.3-rc0
@@ -90,6 +94,12 @@ jobs:
9094
with:
9195
username: ${{ secrets.DOCKERHUB_USERNAME }}
9296
password: ${{ secrets.DOCKERHUB_TOKEN }}
97+
- name: Login to GHCR using PAT
98+
uses: docker/login-action@v3
99+
with:
100+
registry: ghcr.io
101+
username: ${{ github.repository_owner }}
102+
password: ${{ secrets.GITHUB_TOKEN }}
93103
- name: build rootful docker image
94104
uses: docker/build-push-action@v5
95105
with:
@@ -100,6 +110,8 @@ jobs:
100110
labels: ${{ steps.meta.outputs.labels }}
101111
docker-rootless:
102112
runs-on: namespace-profile-gitea-release-docker
113+
permissions:
114+
packages: write # to publish to ghcr.io
103115
steps:
104116
- uses: actions/checkout@v4
105117
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -110,7 +122,9 @@ jobs:
110122
- uses: docker/metadata-action@v5
111123
id: meta
112124
with:
113-
images: gitea/gitea
125+
images: |-
126+
gitea/gitea
127+
ghcr.io/go-gitea/gitea
114128
# each tag below will have the suffix of -rootless
115129
flavor: |
116130
latest=false
@@ -123,6 +137,12 @@ jobs:
123137
with:
124138
username: ${{ secrets.DOCKERHUB_USERNAME }}
125139
password: ${{ secrets.DOCKERHUB_TOKEN }}
140+
- name: Login to GHCR using PAT
141+
uses: docker/login-action@v3
142+
with:
143+
registry: ghcr.io
144+
username: ${{ github.repository_owner }}
145+
password: ${{ secrets.GITHUB_TOKEN }}
126146
- name: build rootless docker image
127147
uses: docker/build-push-action@v5
128148
with:

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ concurrency:
1414
jobs:
1515
binary:
1616
runs-on: namespace-profile-gitea-release-binary
17+
permissions:
18+
packages: write # to publish to ghcr.io
1719
steps:
1820
- uses: actions/checkout@v4
1921
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -71,6 +73,8 @@ jobs:
7173
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
7274
docker-rootful:
7375
runs-on: namespace-profile-gitea-release-docker
76+
permissions:
77+
packages: write # to publish to ghcr.io
7478
steps:
7579
- uses: actions/checkout@v4
7680
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
@@ -81,7 +85,9 @@ jobs:
8185
- uses: docker/metadata-action@v5
8286
id: meta
8387
with:
84-
images: gitea/gitea
88+
images: |-
89+
gitea/gitea
90+
ghcr.io/go-gitea/gitea
8591
# this will generate tags in the following format:
8692
# latest
8793
# 1
@@ -96,6 +102,12 @@ jobs:
96102
with:
97103
username: ${{ secrets.DOCKERHUB_USERNAME }}
98104
password: ${{ secrets.DOCKERHUB_TOKEN }}
105+
- name: Login to GHCR using PAT
106+
uses: docker/login-action@v3
107+
with:
108+
registry: ghcr.io
109+
username: ${{ github.repository_owner }}
110+
password: ${{ secrets.GITHUB_TOKEN }}
99111
- name: build rootful docker image
100112
uses: docker/build-push-action@v5
101113
with:
@@ -116,7 +128,9 @@ jobs:
116128
- uses: docker/metadata-action@v5
117129
id: meta
118130
with:
119-
images: gitea/gitea
131+
images: |-
132+
gitea/gitea
133+
ghcr.io/go-gitea/gitea
120134
# each tag below will have the suffix of -rootless
121135
flavor: |
122136
suffix=-rootless,onlatest=true
@@ -134,6 +148,12 @@ jobs:
134148
with:
135149
username: ${{ secrets.DOCKERHUB_USERNAME }}
136150
password: ${{ secrets.DOCKERHUB_TOKEN }}
151+
- name: Login to GHCR using PAT
152+
uses: docker/login-action@v3
153+
with:
154+
registry: ghcr.io
155+
username: ${{ github.repository_owner }}
156+
password: ${{ secrets.GITHUB_TOKEN }}
137157
- name: build rootless docker image
138158
uses: docker/build-push-action@v5
139159
with:

0 commit comments

Comments
 (0)