-
Notifications
You must be signed in to change notification settings - Fork 56
84 lines (71 loc) · 2.18 KB
/
release-app.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Release App
on:
workflow_dispatch:
inputs:
app:
type: choice
description: Which app to release
options:
- api
- deploy-web
required: true
release-type:
type: choice
description: Which app to release
options:
- prod
- beta
default: prod
force-build:
type: boolean
description: Rebuild the Docker image
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.14.0
- name: Restore root node_modules cache
uses: martijnhols/actions-cache@v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI"
pre_release=""
if [[ "${{ github.event.inputs.release-type }}" == 'beta' ]]; then
prerelease="--preRelease=beta"
fi
force_build=""
if [[ "${{ github.event.inputs.force-build }}" == 'true' ]]; then
force_build="-f"
fi
repo="${{ github.event.inputs.app == 'api' && vars.API_REGISTRY || vars.WEB_REGISTRY }}"
npm run release -w apps/${{ github.event.inputs.app }} -- $pre_release $force_build --verbose --ci -r $repo