diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-and-release-runners.yml similarity index 63% rename from .github/workflows/build-runner.yml rename to .github/workflows/build-and-release-runners.yml index 5e9f5eff..892ebdac 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/build-and-release-runners.yml @@ -1,3 +1,5 @@ +name: Build and Release Runners + on: pull_request: branches: @@ -14,6 +16,8 @@ on: - runner/dindrunner.Dockerfile - runner/entrypoint.sh - .github/workflows/build-runner.yml + release: + types: [published] name: Runner jobs: build: @@ -53,13 +57,31 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - - name: Build [and Push] + # Considered unstable builds + # Mutable (no sha) and immutable (include sha) tags are created, see Issue 285 and PR 286 for why + - name: Build and push canary builds uses: docker/build-push-action@v2 with: context: ./runner file: ./runner/${{ matrix.dockerfile }} platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name != 'pull_request' && github.event_name != 'release' }} + build-args: | + RUNNER_VERSION=${{ env.RUNNER_VERSION }} + DOCKER_VERSION=${{ env.DOCKER_VERSION }} + tags: | + ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-canary + ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-canary-${{ steps.vars.outputs.sha_short }} + + # Considered stable builds + # Mutable (no sha) and immutable (include sha) tags are created, see Issue 285 and PR 286 for why + - name: Build and push release builds + uses: docker/build-push-action@v2 + with: + context: ./runner + file: ./runner/${{ matrix.dockerfile }} + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name == 'release' }} build-args: | RUNNER_VERSION=${{ env.RUNNER_VERSION }} DOCKER_VERSION=${{ env.DOCKER_VERSION }}