Skip to content

Commit 7c4b4da

Browse files
committed
[build] push Docker image to ghcr too
1 parent 004cbf8 commit 7c4b4da

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/docker-build.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
if: github.actor != 'dependabot[bot]' # skip on dependabot because it's not allowed to access secrets
2323
permissions:
24-
contents: read
24+
packages: write
2525
outputs:
2626
app-version: ${{ steps.meta.outputs.version }}
2727
steps:
@@ -32,7 +32,9 @@ jobs:
3232
id: meta
3333
uses: docker/metadata-action@v5
3434
with:
35-
images: capcom6/${{ inputs.app-name }}
35+
images: |
36+
capcom6/${{ inputs.app-name }}
37+
ghcr.io/${{ github.repository }}
3638
tags: |
3739
type=ref,event=branch
3840
type=ref,event=pr
@@ -41,11 +43,18 @@ jobs:
4143
type=semver,pattern={{major}}
4244
4345
- name: Log into Docker Hub
44-
uses: docker/login-action@v2
46+
uses: docker/login-action@v3
4547
with:
4648
username: ${{ secrets.username }}
4749
password: ${{ secrets.password }}
4850

51+
- name: Login to Container registry
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
4958
- name: Set APP_VERSION env
5059
run: echo APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV}
5160
- name: Set APP_RELEASE env

.github/workflows/docker-publish.yml

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252

5353
build:
5454
name: Build
55+
permissions:
56+
packages: write
5557
needs:
5658
- test
5759
- e2e

.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
jobs:
1212
build:
1313
name: Build
14+
permissions:
15+
packages: write
1416
uses: ./.github/workflows/docker-build.yml
1517
with:
1618
app-name: sms-gateway

0 commit comments

Comments
 (0)