From 618665349923283f96634f4741d36c466ea256cd Mon Sep 17 00:00:00 2001 From: Ross Whitfield Date: Mon, 24 Jun 2024 09:34:11 +1000 Subject: [PATCH] Publish version tag only for main branch --- .github/workflows/publish.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 297c72e..3792d55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,10 @@ name: Docker publish on: + workflow_dispatch: push: branches: + - publish_build - next - qa - main @@ -36,24 +38,19 @@ jobs: run: | # --quiet should turn off progress bars to make logs more readable conda env create - - name: Get version - id: version - run: | - conda activate livedata - echo "version=$(versioningit)" >> $GITHUB_OUTPUT - name: Create tag version id: tag run: | conda activate livedata - echo "tag=$(versioningit).b$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT + echo "tag=$(versioningit)" >> $GITHUB_OUTPUT - name: Create latest tag version id: latest_tag run: | case ${{ github.ref }} in - refs/heads/next) + refs/heads/publish_build) echo "latest_tag=latest-dev" >> $GITHUB_OUTPUT ;; @@ -88,7 +85,14 @@ jobs: with: context: . file: Dockerfile - tags: | - ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.latest_tag.outputs.latest_tag }} - ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.tag.outputs.tag }} + tags: ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.latest_tag.outputs.latest_tag }} + push: true + + - name: Push version tag only for main branch + if: github.ref == 'refs/heads/publish_build' + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + tags: ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.tag.outputs.tag }} push: true