From 831db9ee2af4ae5eda7ea52712b6bf9c1aed5e75 Mon Sep 17 00:00:00 2001 From: Tom Bamford <5719506+ap0phi5@users.noreply.github.com> Date: Thu, 4 Feb 2021 00:29:32 +0000 Subject: [PATCH] Added github.sha to DockerHub push (#286) * Added GITHUB.RUN_NUMBER to DockerHub push * switch run_number to sha on docker tag * re-add mutable tags for backwards compatability * truncate to short SHA (7 chars) * behaviour workaround * use ENV to define sha_short * use ::set-output to define sha_short * bump action --- .github/workflows/build-runner.yml | 5 +++++ .github/workflows/release.yml | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-runner.yml index 514fff9e..5e9f5eff 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/build-runner.yml @@ -31,6 +31,10 @@ jobs: DOCKER_VERSION: 19.03.12 DOCKERHUB_USERNAME: ${{ github.repository_owner }} steps: + - name: Set outputs + id: vars + run: echo ::set-output name=sha_short::${GITHUB_SHA::7} + - name: Checkout uses: actions/checkout@v2 @@ -61,4 +65,5 @@ jobs: DOCKER_VERSION=${{ env.DOCKER_VERSION }} tags: | ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }} + ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ steps.vars.outputs.sha_short }} ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb240d13..a741b6cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,10 @@ jobs: env: DOCKERHUB_USERNAME: ${{ github.repository_owner }} steps: + - name: Set outputs + id: vars + run: echo ::set-output name=sha_short::${GITHUB_SHA::7} + - name: Checkout uses: actions/checkout@v2 @@ -52,5 +56,7 @@ jobs: file: Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: ${{ env.DOCKERHUB_USERNAME }}/actions-runner-controller:${{ env.VERSION }} + tags: | + ${{ env.DOCKERHUB_USERNAME }}/actions-runner-controller:${{ env.VERSION }} + ${{ env.DOCKERHUB_USERNAME }}/actions-runner-controller:${{ env.VERSION }}-${{ steps.vars.outputs.sha_short }}