Repository navigation
64 lines (56 loc) · 2.19 KB
/
Copy pathdeploy.yml
File metadata and controls
64 lines (56 loc) · 2.19 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Deploy
on:
push:
branches: [main, staging, production]
permissions:
contents: read
jobs:
# Branch and GitHub environment names differ, so map them explicitly here,
# once; the `environment` and `concurrency` keys cannot read workflow `env`.
resolve:
name: Resolve deploy environment
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.map.outputs.environment }}
steps:
- id: map
env:
BRANCH: ${{ github.ref_name }}
run: |
case "$BRANCH" in
main) environment=Test ;;
staging) environment=Staging ;;
production) environment=Production ;;
*) echo "::error::No deploy environment is mapped to branch '$BRANCH'; add it to deploy.yml." >&2; exit 1 ;;
esac
echo "environment=$environment" >> "$GITHUB_OUTPUT"
deploy:
name: Install HappyView modules (${{ needs.resolve.outputs.environment }})
needs: resolve
runs-on: ubuntu-latest
environment: ${{ needs.resolve.outputs.environment }}
# Deploys to one environment run one at a time and are never cancelled midway.
concurrency:
group: deploy-${{ needs.resolve.outputs.environment }}
cancel-in-progress: false
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install API modules into HappyView
env:
HAPPYVIEW_BASE_URL: ${{ vars.HAPPYVIEW_BASE_URL }}
HAPPYVIEW_ADMIN_TOKEN: ${{ secrets.HAPPYVIEW_ADMIN_TOKEN }}
HYPERCERTS_HANDLE_RESOLVER_URL: ${{ vars.HYPERCERTS_HANDLE_RESOLVER_URL }}
# The repo is the source of truth: replace any differing installed assets.
run: pnpm --filter @hypercerts-org/happyview-modules install:api --override