From 126f5a9167be0b4358a082bf4b847cf125c61442 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Thu, 22 Aug 2024 04:23:25 +0000 Subject: [PATCH 1/2] feat: add workflow for promoting 'latest' docker tag - Don't automatically promote 'latest' tag --- .github/workflows/latest.yaml | 47 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 5 ---- 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/latest.yaml diff --git a/.github/workflows/latest.yaml b/.github/workflows/latest.yaml new file mode 100644 index 0000000..2f785da --- /dev/null +++ b/.github/workflows/latest.yaml @@ -0,0 +1,47 @@ +name: promote-latest + +on: + workflow_dispatch: + inputs: + tag: + description: "The tag to point latest to" + required: true + default: main + +permissions: + actions: read + checks: none + contents: write + deployments: none + issues: none + packages: write + pull-requests: none + repository-projects: none + security-events: none + statuses: none + +jobs: + manifest: + runs-on: ubuntu-22.04 + needs: release + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.tag }} + - name: Docker Login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create Manifest + run: | + docker manifest create ghcr.io/coder/envbox:latest \ + --amend ghcr.io/coder/envbox:${{ github.event.inputs.tag }}-amd64 \ + --amend ghcr.io/coder/envbox:${{ github.event.inputs.tag }}-arm64 + + - name: Push Manifest + run: | + docker manifest push ghcr.io/coder/envbox:latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6baa68a..d73a466 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -103,14 +103,9 @@ jobs: docker manifest create ghcr.io/coder/envbox:${{ github.event.inputs.version }} \ --amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-amd64 \ --amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-arm64 - docker manifest create ghcr.io/coder/envbox:latest \ - --amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-amd64 \ - --amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-arm64 - - name: Push Manifest run: | docker manifest push ghcr.io/coder/envbox:${{ github.event.inputs.version }} - docker manifest push ghcr.io/coder/envbox:latest tag: runs-on: ubuntu-22.04 From 1e326812dda6ecd6147c2829cf94ea3a70898f79 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Thu, 22 Aug 2024 04:27:44 +0000 Subject: [PATCH 2/2] no default --- .github/workflows/latest.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/latest.yaml b/.github/workflows/latest.yaml index 2f785da..12f3434 100644 --- a/.github/workflows/latest.yaml +++ b/.github/workflows/latest.yaml @@ -6,7 +6,6 @@ on: tag: description: "The tag to point latest to" required: true - default: main permissions: actions: read