From 1f40813fedccdaaf5f9441a715fd7ed06cd04cad Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 29 Mar 2026 09:15:51 +0200 Subject: workflows/ci: do Docker builds on PRs --- .github/workflows/ci.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f761f73..19551dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,6 @@ jobs: needs: [test_host, test_linuxserver] runs-on: ubuntu-latest name: 'Publish' - if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') steps: - name: Checkout uses: actions/checkout@v6 @@ -50,20 +49,27 @@ 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: egortensin - 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: egortensin + password: '${{ secrets.DOCKERHUB_TOKEN }}' - name: Build and publish uses: docker/build-push-action@v7 with: @@ -71,6 +77,6 @@ jobs: # https://stackoverflow.com/a/74552407/514684 context: . 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 }}' -- cgit v1.3