From 165979ba8b756c015c8a42b6beb1c1fc15dab5fe Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Wed, 22 Oct 2025 12:30:22 -0700 Subject: [PATCH] Make releasing the dev container release the WASI container --- .github/workflows/build-and-push.yml | 45 ++++++++++++++++++++ .github/workflows/release.yml | 61 ++++++++++++---------------- 2 files changed, 72 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..dc5ef1b --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,45 @@ +name: Build and Push Container + +on: + workflow_call: + inputs: + container: + description: "Container image name" + required: true + type: string + +jobs: + build-and-push: + concurrency: + group: release-to-ghcr-${{ inputs.container }} + cancel-in-progress: false + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Set Calver Date + run: | + echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT + id: version + - name: Checkout + uses: actions/checkout@v5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login To GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./${{ inputs.container }} + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/python/${{ inputs.container }}:${{ steps.version.outputs.builddate }}.${{ github.run_id }} + ghcr.io/python/${{ inputs.container }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f64d0bf..7a67638 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,8 @@ name: release on: workflow_dispatch: inputs: - package: - description: "Package name" + container: + description: "Container image name" required: true default: 'autoconf' type: choice @@ -13,39 +13,32 @@ on: - devcontainer - wasicontainer -run-name: "Release: ${{ inputs.package }}" +run-name: "Release: ${{ inputs.container }}${{ inputs.container == 'devcontainer' && ' + wasicontainer' || '' }}" jobs: - release-to-ghcr: - concurrency: - group: release-to-ghcr-${{ inputs.package }} - cancel-in-progress: false - if: contains('["brettcannon", "corona10", "erlend-aasland"]', github.actor) + authorize: runs-on: ubuntu-latest + if: contains('["brettcannon", "corona10", "erlend-aasland"]', github.actor) steps: - # Checkout push-to-registry action github repository - - name: Set Calver Date - run: | - echo "builddate=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT - id: version - - name: Checkout Push to Registry action - uses: actions/checkout@v5 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login To GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ./${{ inputs.package }} - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/python/${{ inputs.package }}:${{ steps.version.outputs.builddate }}.${{ github.run_id }} - ghcr.io/python/${{ inputs.package }}:latest + - run: echo "Authorized" + + release-to-ghcr: + name: Release ${{ inputs.container }} + needs: authorize + uses: ./.github/workflows/build-and-push.yml + permissions: + contents: read + packages: write + with: + container: ${{ inputs.container }} + + release-wasicontainer: + name: Release wasicontainer (due to devcontainer updates) + needs: [authorize, release-to-ghcr] + if: inputs.container == 'devcontainer' + uses: ./.github/workflows/build-and-push.yml + permissions: + contents: read + packages: write + with: + container: wasicontainer