-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (42 loc) · 1.36 KB
/
api-deploy-release.yml
File metadata and controls
46 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: API deploy release
description: Build and deploy the API when a release is published
on:
release:
types: [published]
jobs:
get-version:
# only run for releases with tag 'iapp-api-v*' as created by release-please for API
if: startsWith(github.ref_name,'iapp-api-v')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set publish version
id: set-publish-version
working-directory: api
run: |
VERSION=$(npm pkg get version | tr -d '"')
echo "VERSION=${VERSION}" | tee -a $GITHUB_OUTPUT
outputs:
version: ${{ steps.set-publish-version.outputs.VERSION }}
docker-publish:
if: startsWith(github.ref_name,'iapp-api-v')
needs: get-version
uses: ./.github/workflows/reusable-api-docker.yml
with:
tag: ${{ needs.get-version.outputs.version }}
secrets:
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
docker-password: ${{ secrets.DOCKERHUB_PAT }}
deploy:
if: startsWith(github.ref_name,'iapp-api-v')
needs: [get-version, docker-publish]
uses: ./.github/workflows/reusable-api-deploy.yml
with:
tag: ${{ needs.get-version.outputs.version }}
secrets:
host: ${{ secrets.API_HOST }}