-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (67 loc) · 2.25 KB
/
cloud-deploy-preview.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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "[Cloud] Preview Deploy"
on:
pull_request:
branches:
- "main"
- "next"
env:
DOTNET_VERSION: "7.0.x" # set this to the dotnet version to use
defaults:
run:
working-directory: ./cloud/infrastructure
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@v4
- name: ✋ Set up mutex
id: mutex-setup
run: |
pushd ../../discrete/Signalco.Discrete.Api.Mutex/node-cli
npm install
npm install -g
npx mutex wait signalcocloudpreview
popd
- name: ✨ Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: ✨ Setup pnpm
uses: pnpm/[email protected]
with:
version: 'latest'
- name: ✨ Setup Node LTS
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: pnpm
cache-dependency-path: ./cloud/infrastructure
- name: 📦️ Installing dependencies
run: pnpm i --frozen-lockfile
- name: 🔎 Determine stack
shell: bash
run: |
[[ $(echo ${BASE_BRANCH#refs/heads/}) = "main" ]] && echo "##[set-output name=branch;]production" || echo "##[set-output name=branch;]$(echo ${BASE_BRANCH#refs/heads/})"
id: extract_branch
env:
BASE_BRANCH: ${{ github.base_ref }}
- name: ⚡ Preview Deploy Infrastructure
uses: pulumi/actions@v4
with:
command: preview
stack-name: signalco/cloud-primary/${{ steps.extract_branch.outputs.branch }}
work-dir: ./cloud/infrastructure
comment-on-pr: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
- name: ✋ Release mutex
if: always() && steps.mutex-setup.outcome == 'success'
run: |
pushd ../../discrete/Signalco.Discrete.Api.Mutex/node-cli
npm install
npm install -g
npx mutex release signalcocloudpreview
popd