Skip to content

Commit

Permalink
Unify script
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhoan-axonivy committed Jul 16, 2024
1 parent 489e540 commit 96bebcb
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,25 @@ jobs:
steps:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
- name: Push UI image
- name: Refine release version
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$UI_IMAGE_NAME
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# This strips the git ref prefix from the version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# This strips the "v" prefix from the tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $UI_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Push UI image
run: |
UI_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$UI_IMAGE_NAME
echo IMAGE_ID=$UI_IMAGE_ID
docker tag $UI_IMAGE_NAME $UI_IMAGE_ID:$VERSION
docker push $UI_IMAGE_ID:$VERSION
- name: Push Service image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$SERVICE_IMAGE_NAME
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# This strips the git ref prefix from the version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# This strips the "v" prefix from the tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SERVICE_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
SERVICE_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$SERVICE_IMAGE_NAME
echo IMAGE_ID=$SERVICE_IMAGE_ID
docker tag $SERVICE_IMAGE_NAME $SERVICE_IMAGE_ID:$VERSION
docker push $SERVICE_IMAGE_ID:$VERSION

0 comments on commit 96bebcb

Please sign in to comment.