forked from YACS-RCOS/yacs.n
-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (67 loc) · 2.43 KB
/
pr-cd.yaml
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
name: PR Temp Deploys
on:
pull_request:
branches: [master]
workflow_dispatch:
jobs:
wait-checks:
runs-on: ubuntu-latest
steps:
# action doesn't support multiple checks yet so
# use a step for each check
- name: Wait for ci to complete
uses: fountainhead/[email protected]
id: wait-for-ci
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: CI
ref: ${{ github.event.pull_request.head.sha }}
- name: Check if ci was successful
if: steps.wait-for-ci.outputs.conclusion != 'success'
run: exit 1
- name: Wait for codefactor to complete
uses: fountainhead/[email protected]
id: wait-for-codefactor
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: CodeFactor
ref: ${{ github.event.pull_request.head.sha }}
- name: Check if codefactor was successful
if: steps.wait-for-codefactor.outputs.conclusion != 'success'
run: exit 1
temp_deploy:
runs-on: ubuntu-latest
needs: wait-checks
steps:
- uses: actions/checkout@v2
- name: Use Node.js 13.x
uses: actions/setup-node@v1
with:
node-version: 13.x
- name: echo env (for info)
shell: bash
run: |
echo "##[set-output name=branch;]$(echo $GITHUB_HEAD_REF)"
echo "##[set-output name=datetime_ready;]$(TZ='America/New_York' date --date '10 minutes')"
id: info
- name: Provision Infrastructure
run: |
cd ops/
npm install
node provision.js | tee out.txt
echo "##[set-output name=link;]$(cat out.txt | grep http)"
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
SERVER_ROOT_PASS: ${{ secrets.SERVER_ROOT_PASS }}
SSH_PUB_KEYS: ${{ secrets.SSH_PUB_KEYS }}
ACTIVE_SERVER_COUNT: ${{ secrets.ACTIVE_SERVER_COUNT }} # amount of vms to keep in the active queue
BRANCH: ${{ steps.info.outputs.branch }}
id: provision
- name: Share Link on PR
uses: thollander/actions-comment-pull-request@master
with:
message: |
Deploy Link: ${{ steps.provision.outputs.link }}/
Branch and Build Info: ${{ steps.provision.outputs.link }}:3000/info.txt
Expected Time Ready: ${{ steps.info.outputs.datetime_ready }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}