-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication-js-cloudflare-master.yml
More file actions
100 lines (97 loc) · 2.88 KB
/
Copy pathapplication-js-cloudflare-master.yml
File metadata and controls
100 lines (97 loc) · 2.88 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: "CI / Application JS Cloudflare Master"
on:
workflow_call:
inputs:
environment:
description: 'Deployment Environment'
type: string
required: true
ref:
type: string
default: master
description: >
Reference used for this repository, so we can re-use it when
referencing local actions, and avoid having to checkout this
repository separately.
secrets:
NIXPKGS_PRIVATE_PAT:
required: true
DEPLOY_SECRETS:
required: true
jobs:
# Build the public - JS is platform-agnostic
master-build:
name: "Master / Build"
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
environment: ${{ inputs.environment }}
steps:
- name: Checkout Actions
uses: actions/checkout@v4
with:
repository: MatrixAI/.github
ref: ${{ inputs.ref }}
path: tmp/.github
- name: Parse Secrets
uses: ./tmp/.github/.github/actions/secrets-parse
with:
secrets: ${{ secrets.DEPLOY_SECRETS }}
- uses: actions/checkout@v4
with:
lfs: true
- uses: MatrixAI/.github/.github/actions/matrixai-env-setup@master
- name: Setup Deploy Secrets
run: |
echo "${{ inputs.DEPLOY_SECRETS }}" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' >> $GITHUB_ENV
- name: Run build
env:
NIX_CONFIG: access-tokens = github.com=${{ secrets.NIXPKGS_PRIVATE_PAT }}
run: |
nix develop .#ci --command bash -c $'
npm run build --verbose
'
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: public
path: ./public
# Deploy the public
master-deployment:
name: "Master / Deployment"
runs-on: ubuntu-latest
needs: master-build
concurrency:
group: master-deployment
cancel-in-progress: false
permissions:
contents: read
environment: ${{ inputs.environment }}
steps:
- name: Checkout Actions
uses: actions/checkout@v4
with:
repository: MatrixAI/.github
ref: ${{ inputs.ref }}
path: tmp/.github
- uses: MatrixAI/.github/.github/actions/matrixai-env-setup@master
- name: Parse Secrets
uses: ./tmp/.github/.github/actions/secrets-parse
with:
secrets: ${{ secrets.DEPLOY_SECRETS }}
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/download-artifact@v4
with:
name: public
path: ./public
- name: Run deployment
env:
NIX_CONFIG: access-tokens = github.com=${{ secrets.NIXPKGS_PRIVATE_PAT }}
run: |
echo 'Perform service deployment for master'
nix develop .#ci --command bash -c $'
npm run deploy -- --env master
'