Skip to content

Commit

Permalink
Tag docker container as latest accordingly to the version (#4241)
Browse files Browse the repository at this point in the history
* Tag latest release

* Tag latest release

* Code review

* Push latest and version tag
  • Loading branch information
andrzejewsky committed Sep 27, 2023
1 parent 3070d51 commit db43c91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-sheep-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Tag docker container as latest when the published GitHub release is marked as "latest"
17 changes: 13 additions & 4 deletions .github/workflows/publish-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ jobs:
# Pre-releases, alphas, etc. as :snapshot
- name: Output image tags from git tag events
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GH_TOKEN: ${{ github.token }}
run: |
# Remove everything else than the tagged version
DASHBOARD_VERSION=${GITHUB_REF#refs/tags/}
LATEST_VERSION=$(gh api repos/saleor/saleor-dashboard/releases/latest | jq -r .tag_name)
CURRENT_TAG=${GITHUB_REF#refs/tags/}
if [ "$LATEST_VERSION" = "$CURRENT_TAG" ]; then
TAGS=${{ steps.image.outputs.image_name }}:${CURRENT_TAG},${{ steps.image.outputs.image_name }}:latest
else
TAGS=${{ steps.image.outputs.image_name }}:${CURRENT_TAG}
fi
echo "
DASHBOARD_VERSION=${DASHBOARD_VERSION}
CONTAINER_TAGS=${{ steps.image.outputs.image_name }}:${DASHBOARD_VERSION}
DASHBOARD_VERSION=${CURRENT_TAG}
CONTAINER_TAGS=${TAGS}
" >> "${GITHUB_ENV}"
- name: Set up Docker QEMU
Expand Down

0 comments on commit db43c91

Please sign in to comment.