From ce31e83813cd0d51413bd0cfb4d22754727c719d Mon Sep 17 00:00:00 2001 From: David de Boer Date: Thu, 27 Jun 2024 10:03:51 +0200 Subject: [PATCH] fix: Docker release Needs to be in the same workflow because using GITHUB_TOKEN a workflow run will not trigger another workflow. --- .github/workflows/docker.yml | 41 ----------------------------------- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 77119c4..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Publish Docker image - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - push_to_registry: - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - attestations: write - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }} - - uses: docker/build-push-action@v5 - id: push - with: - context: . - file: docker/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.output.labels }} - - uses: actions/attest-build-provenance@v1 - with: - subject-name: ghcr.io/${{ github.repository }} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ee34ac..1899ba6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ permissions: contents: read jobs: - build: + npm: runs-on: ubuntu-latest permissions: contents: write @@ -17,7 +17,7 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: lts/* - run: npm ci @@ -26,3 +26,36 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + docker: + needs: npm + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/${{ github.repository }} + - uses: docker/build-push-action@v5 + id: push + with: + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.output.labels }} + - uses: actions/attest-build-provenance@v1 + with: + subject-name: ghcr.io/${{ github.repository }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true