diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e75f861..9e3653f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ name: docker on: workflow_dispatch: {} push: + branches: [main] tags: - v* @@ -28,9 +29,13 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get short commit + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Build and push tagged uses: docker/build-push-action@v6 - if: github.event_name != 'workflow_dispatch' + if: startsWith(github.ref, 'refs/tags/') with: context: . file: Dockerfile @@ -39,17 +44,13 @@ jobs: tags: | ghcr.io/tempoxyz/rpc-tester:latest ghcr.io/tempoxyz/rpc-tester:${{ github.ref_name }} + ghcr.io/tempoxyz/rpc-tester:${{ steps.vars.outputs.sha_short }} cache-from: type=gha cache-to: type=gha,mode=max - - name: Get short commit - if: github.event_name == 'workflow_dispatch' - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Build and push dispatched + - name: Build and push commit uses: docker/build-push-action@v6 - if: github.event_name == 'workflow_dispatch' + if: ${{ !startsWith(github.ref, 'refs/tags/') }} with: context: . file: Dockerfile