@@ -57,29 +57,27 @@ jobs:
5757 github-release :
5858 name : Github Release
5959 runs-on : ubuntu-latest
60- needs : [test, lint, deploy]
60+ needs : [deploy]
6161 if : github.event_name != 'pull_request'
62+ outputs :
63+ new_release_published : ${{ steps.semantic.outputs.steps.semantic.outputs.new_release_published}}
64+ version : ${{ steps.semantic.outputs.new_release_version }}
6265 steps :
63- - name : Checkout
66+ - name : Checkout latest code
6467 uses : actions/checkout@v2
6568 with :
6669 fetch-depth : 0
67- - name : Setup Node.js
68- uses : actions/setup-node@v2
69- with :
70- node-version : ' lts/*'
71- - name : Install dependencies
72- run : npm install
73- - name : Release
70+ - name : Semantic Release
71+ id : semantic
72+ uses : cycjimmy/semantic-release-action@v3
7473 env :
7574 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76- run : npx semantic-release
7775
7876 container-release :
7977 name : Container Release
8078 runs-on : ubuntu-latest
81- needs : [test, lint, deploy, github-release]
82- if : github.event_name != 'pull_request '
79+ needs : [github-release]
80+ if : ${{needs. github-release.outputs.new_release_published}} == 'true '
8381 env :
8482 REGISTRY : ghcr.io
8583 IMAGE_NAME : ${{ github.repository }}
@@ -89,32 +87,20 @@ jobs:
8987 steps :
9088 - name : Checkout repository
9189 uses : actions/checkout@v2
92-
9390 - name : Log in to the Container registry
9491 uses : docker/login-action@v1
9592 with :
9693 registry : ${{ env.REGISTRY }}
9794 username : ${{ github.actor }}
9895 password : ${{ secrets.GITHUB_TOKEN }}
99-
100- - name : Extract metadata (tags, labels) for Docker
101- id : meta
102- uses : docker/metadata-action@v3
103- with :
104- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
105- tags : |
106- type=ref,event=branch
107- type=ref,event=pr
108- type=semver,pattern={{version}}
109- type=semver,pattern={{major}}.{{minor}}
110-
11196 - name : Build and push Docker image
11297 uses : docker/build-push-action@v2
11398 with :
11499 context : .
115100 push : ${{ github.event_name != 'pull_request' }}
116- tags : ${{ steps.meta.outputs.tags }}
117- labels : ${{ steps.meta.outputs.labels }}
101+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.github-release.outputs.version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
102+ labels :
103+ version=${{ needs.github-release.outputs.version }}
118104
119105 trigger_downstream :
120106 name : Trigger downstream
0 commit comments