diff options
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5403616..076e36d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,6 @@ jobs: - {service: backend, file: docker/Dockerfile, image: cgitize} - {service: frontend, context: docker/frontend, image: cgitize-frontend} name: 'Publish / Docker Hub / ${{ matrix.service }}' - if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') steps: - name: Checkout uses: actions/checkout@v6 @@ -104,28 +103,35 @@ jobs: uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - - name: Login to Docker Hub - uses: docker/login-action@v4 - with: - username: '${{ secrets.DOCKERHUB_USERNAME }}' - password: '${{ secrets.DOCKERHUB_TOKEN }}' - - id: platforms - name: Which platforms? + - name: Push? Which platforms? + id: params # Building for ARM for every commit in master is too time-consuming. run: | - if [ '${{ github.ref }}' = 'refs/heads/master' ]; then + if ${{ github.ref == 'refs/heads/master' }}; then + echo 'push=true' >> "$GITHUB_OUTPUT" echo 'platforms=amd64' >> "$GITHUB_OUTPUT" - else + elif ${{ startsWith(github.ref, 'refs/tags/') }}; then + echo 'push=true' >> "$GITHUB_OUTPUT" echo 'platforms=amd64,armhf,arm64' >> "$GITHUB_OUTPUT" + else + echo 'push=false' >> "$GITHUB_OUTPUT" + echo 'platforms=amd64' >> "$GITHUB_OUTPUT" fi + - name: Login to Docker Hub + # https://github.com/orgs/community/discussions/163013 + if: steps.params.outputs.push == 'true' + uses: docker/login-action@v4 + with: + username: '${{ secrets.DOCKERHUB_USERNAME }}' + password: '${{ secrets.DOCKERHUB_TOKEN }}' - name: Build and publish uses: docker/build-push-action@v7 with: context: '${{ matrix.context }}' file: '${{ matrix.file }}' labels: '${{ steps.meta.outputs.labels }}' - platforms: '${{ steps.platforms.outputs.platforms }}' - push: true + platforms: '${{ steps.params.outputs.platforms }}' + push: '${{ steps.params.outputs.push }}' tags: '${{ steps.meta.outputs.tags }}' publish_pypi: |
