Skip to content

Commit

Permalink
ci: 🎡 add GHCR deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
abcfy2 committed Jul 9, 2024
1 parent 679d974 commit e796fa9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/docker_build_alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ on:

env:
DOCKER_REPOSITORY: abcfy2/zhparser
GHCR_REPOSITORY: ghcr.io/${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -49,6 +55,12 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REPOSITORY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -63,14 +75,14 @@ jobs:
PG_TAG: ${{ matrix.pg_tag }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ env.PUSH }}
pull: true
file: Dockerfile.alpine
build-args: |
PG_TAG=${{ matrix.pg_tag }}
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.DOCKER_REPOSITORY }}:${{ matrix.pg_tag }}
tags: ${{ env.DOCKER_REPOSITORY }}:${{ matrix.pg_tag }},${{ env.GHCR_REPOSITORY }}:${{ matrix.pg_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
16 changes: 14 additions & 2 deletions .github/workflows/docker_build_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ on:

env:
DOCKER_REPOSITORY: abcfy2/zhparser
GHCR_REPOSITORY: ghcr.io/${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -49,6 +55,12 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REPOSITORY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -63,14 +75,14 @@ jobs:
PG_TAG: ${{ matrix.pg_tag }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ env.PUSH }}
pull: true
file: Dockerfile.debian
build-args: |
PG_TAG=${{ matrix.pg_tag }}
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.DOCKER_REPOSITORY }}:${{ matrix.pg_tag }}
tags: ${{ env.DOCKER_REPOSITORY }}:${{ matrix.pg_tag }},${{ env.GHCR_REPOSITORY }}:${{ matrix.pg_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/docker_hub_description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand Down

0 comments on commit e796fa9

Please sign in to comment.