Skip to content

Commit

Permalink
chore(ci): image release - fix local image path
Browse files Browse the repository at this point in the history
  • Loading branch information
heronimus committed Aug 16, 2023
1 parent 7eba47a commit 688c027
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/backend-mage-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
- 'v*.*.*'

env:
IMAGE_NAME_NAKAMA: starter-game-template/nakama
IMAGE_NAME_CARDINAL: starter-game-template/cardinal
IMAGE_NAME_TESTSUITE: starter-game-template/testsuite
REGISTRY_URL: us-docker.pkg.dev

jobs:
Expand Down Expand Up @@ -51,9 +48,9 @@ jobs:
docker image ls -a | grep starter-game-template
- name: Docker save local build images
run: |
docker save ${{ env.IMAGE_NAME_NAKAMA }}:latest > /tmp/${{ env.IMAGE_NAME_NAKAMA }}-latest.tar
docker save ${{ env.IMAGE_NAME_CARDINAL }}:latest > /tmp/${{ env.IMAGE_NAME_CARDINAL }}-latest.tar
docker save ${{ env.IMAGE_NAME_TESTSUITE }}:latest > /tmp/${{ env.IMAGE_NAME_TESTSUITE }}-latest.tar
docker save ${{ github.event.repository.name }}-nakama:latest > /tmp/${{ github.event.repository.name }}-nakama-latest.tar
docker save ${{ github.event.repository.name }}-cardinal:latest > /tmp/${{ github.event.repository.name }}-cardinal-latest.tar
docker save ${{ github.event.repository.name }}-testsuite:latest > /tmp/${{ github.event.repository.name }}-testsuite-latest.tar
- name: Upload local build images to temporary artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -78,9 +75,9 @@ jobs:
path: /tmp/
- name: Load image and show build images
run: |
docker load --input /tmp/${{ env.IMAGE_NAME_NAKAMA }}-latest.tar
docker load --input /tmp/${{ env.IMAGE_NAME_CARDINAL }}-latest.tar
docker load --input /tmp/${{ env.IMAGE_NAME_TESTSUITE }}-latest.tar
docker load --input /tmp/${{ github.event.repository.name }}-nakama-latest.tar
docker load --input /tmp/${{ github.event.repository.name }}-cardinal-latest.tar
docker load --input /tmp/${{ github.event.repository.name }}-testsuite-latest.tar
docker image ls -a | grep starter-game-template
- name: GCP auth
id: auth
Expand All @@ -97,23 +94,23 @@ jobs:
gcloud auth configure-docker ${{ env.REGISTRY_URL }}
- name: Push image
run: |
IMAGE_ID_NAKAMA=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_NAKAMA }}
IMAGE_ID_NAKAMA=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ github.event.repository.name }}/nakama
IMAGE_ID_NAKAMA=$(echo $IMAGE_ID_NAKAMA | tr '[A-Z]' '[a-z]')
IMAGE_ID_CARDINAL=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_CARDINAL }}
IMAGE_ID_CARDINAL=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ github.event.repository.name }}/cardinal
IMAGE_ID_CARDINAL=$(echo $IMAGE_ID_CARDINAL | tr '[A-Z]' '[a-z]')
IMAGE_ID_TESTSUITE=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME_TESTSUITE }}
IMAGE_ID_TESTSUITE=${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ github.event.repository.name }}/testsuite
IMAGE_ID_TESTSUITE=$(echo $IMAGE_ID_TESTSUITE | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
[ "$VERSION" == "merge" ] && VERSION=latest
docker tag ${{ env.IMAGE_NAME_NAKAMA }}:latest $IMAGE_ID_NAKAMA:$VERSION
docker tag ${{ env.IMAGE_NAME_CARDINAL }}:latest $IMAGE_ID_CARDINAL:$VERSION
docker tag ${{ env.IMAGE_NAME_TESTSUITE }}:latest $IMAGE_ID_TESTSUITE:$VERSION
docker tag ${{ github.event.repository.name }}-nakama:latest $IMAGE_ID_NAKAMA:$VERSION
docker tag ${{ github.event.repository.name }}-cardinal:latest $IMAGE_ID_CARDINAL:$VERSION
docker tag ${{ github.event.repository.name }}-testsuite:latest $IMAGE_ID_TESTSUITE:$VERSION
docker push $IMAGE_ID_NAKAMA:$VERSION
docker push $IMAGE_ID_CARDINAL:$VERSION
Expand Down

0 comments on commit 688c027

Please sign in to comment.