Skip to content

Commit

Permalink
Publish version tag only for main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rosswhitfield committed Jun 23, 2024
1 parent 9e8aadd commit 45bf588
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Docker publish

on:
workflow_dispatch:
push:
branches:
- publish_build
- next
- qa
- main
Expand Down Expand Up @@ -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
;;
Expand Down Expand Up @@ -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/tags/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

0 comments on commit 45bf588

Please sign in to comment.