diff --git a/.dockerignore b/.dockerignore index 8e0b69332..2abeb2727 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +.git/ build/ .github/ .tx/ diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 937386940..967d94c58 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -20,22 +20,11 @@ on: release: types: - released # publishing of stable releases - workflow_dispatch: # (re)publish the image for an existing stable release - inputs: - tag: - description: 'Existing release tag to build and publish (e.g. 2026-10-03-Release-3.1.0)' - required: true - type: string - latest: - description: 'Also update the "latest" tag' - required: true - type: boolean - default: true -# Cancel earlier, unfinished runs of this workflow on the same branch (unless publishing) +# Cancel earlier, unfinished runs of this workflow on the same branch (unless on release) concurrency: - group: "${{ github.workflow }} @ ${{ inputs.tag || github.ref_name }}" - cancel-in-progress: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }} + group: "${{ github.workflow }} @ ${{ github.ref_name }}" + cancel-in-progress: ${{ github.event_name != 'release' }} env: GHCR_IMAGE: ghcr.io/cockatrice/servatrice @@ -68,14 +57,12 @@ jobs: steps: - name: "Checkout" uses: actions/checkout@v7 - with: - ref: ${{ case(github.event_name == 'workflow_dispatch', format('refs/tags/{0}', inputs.tag), '') }} - name: "Set up Docker buildx" uses: docker/setup-buildx-action@v4 - name: "Login to GitHub Container Registry (GHCR)" - if: (github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch' + if: github.event_name == 'release' && github.event.release.prerelease == false id: login uses: docker/login-action@v4 with: @@ -83,7 +70,7 @@ jobs: username: ${{ github.actor }} password: ${{ github.token }} - # Don't push for non-publishing triggers + # Don't push for non-release triggers - name: "Build image" if: steps.login.outcome != 'success' uses: docker/build-push-action@v7 @@ -124,6 +111,7 @@ jobs: if: steps.login.outcome == 'success' uses: actions/upload-artifact@v7 with: + archive: false if-no-files-found: error name: digest-${{ matrix.label }} path: ${{ runner.temp }}/digests/* @@ -133,7 +121,7 @@ jobs: # Create an OCI image index from the platform-specific image manifests index: name: "Publish multi-platform Servatrice image" - if: github.repository_owner == 'Cockatrice' && ((github.event_name == 'release' && github.event.release.prerelease == false) || github.event_name == 'workflow_dispatch') + if: github.repository_owner == 'Cockatrice' && github.event_name == 'release' && github.event.release.prerelease == false needs: build runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md @@ -159,11 +147,8 @@ jobs: images: ${{ env.GHCR_IMAGE }} flavor: | latest=auto - # if semver, also: type=semver,pattern={{version}} / {{major}}.{{minor}} tags: | - type=ref,event=tag - type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }} - type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && inputs.latest }} + type=ref,event=tag # if semver, also: type=semver,pattern={{version}} / {{major}}.{{minor}} # Add OCI annotations to image index and publish tags - name: "Create image index" @@ -191,7 +176,7 @@ jobs: - name: "Inspect images" env: - GITHUB_TAG: ${{ inputs.tag || github.ref_name }} + GITHUB_TAG: ${{ github.ref_name }} run: | docker buildx imagetools inspect "$GHCR_IMAGE:latest" docker buildx imagetools inspect "$GHCR_IMAGE:$GITHUB_TAG"