Skip to content

Commit 59d97a2

Browse files
committed
ci: add GitHub Container Registry (ghcr.io) publishing
1 parent f535158 commit 59d97a2

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/github-build.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
jobs:
1313
multi:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
1518
steps:
1619
-
1720
name: Checkout
@@ -29,14 +32,25 @@ jobs:
2932
with:
3033
username: ${{ secrets.DOCKER_USERNAME }}
3134
password: ${{ secrets.DOCKER_PASSWORD }}
35+
-
36+
name: Login to GitHub Container Registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
3242

3343
- if: github.ref == 'refs/heads/main'
3444
name: Conditional(Set tag as `latest`)
35-
run: echo "tag=willfarrell/autoheal:latest" >> $GITHUB_ENV
45+
run: |
46+
echo "tag=willfarrell/autoheal:latest" >> $GITHUB_ENV
47+
echo "ghcr_tag=ghcr.io/${{ github.repository }}:latest" >> $GITHUB_ENV
3648
3749
- if: startsWith(github.ref, 'refs/tags/')
3850
name: Conditional(Set tag as `{version}`)
39-
run: echo "tag=willfarrell/autoheal:${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
51+
run: |
52+
echo "tag=willfarrell/autoheal:${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
53+
echo "ghcr_tag=ghcr.io/${{ github.repository }}:${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
4054
4155
-
4256
name: Build and push
@@ -48,3 +62,4 @@ jobs:
4862
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le
4963
tags: |
5064
${{ env.tag }}
65+
${{ env.ghcr_tag }}

0 commit comments

Comments
 (0)