forked from kubev2v/forklift-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (39 loc) · 1.55 KB
/
deploy-pr-preview.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
name: PR Preview
on: pull_request
jobs:
deploy-pr-preview:
name: Deploy to Surge
runs-on: ubuntu-20.04
steps:
- name: Set up token
id: token
# This is a base64-encoded OAuth token for the "konveyor-preview-bot" GitHub account, which has no secure access.
run: echo "::set-output name=GH_TOKEN::`echo 'ODk3MzkyNzJlMDQwZjQ3YThhODJjYjYwZmFhM2RlOWQ3ZTk2YWM3OQo=' | base64 -d`"
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: Build in mock mode
run: npm run build:mock
- name: Generate Surge URL
uses: actions/github-script@v3
id: surge-url
with:
github-token: ${{ steps.token.outputs.GH_TOKEN }}
script: |
const { issue: { number: issue_number } } = context;
return `konveyor-forklift-ui-pr-${issue_number}-preview.surge.sh`;
result-encoding: string
- name: Install Surge
run: npm install -g surge
- name: Deploy to Surge
run: surge ./dist/ "${{steps.surge-url.outputs.result}}" --token 62bd7a07b9bf812ff8d3ea91ccd2dc2f
- name: Post URL as PR comment
uses: mshick/add-pr-comment@v1
with:
message: "🚀 Deployed Preview: http://${{steps.surge-url.outputs.result}} ✨\n\nCompare with current main branch: http://konveyor-forklift-ui-preview.surge.sh"
repo-token: ${{ steps.token.outputs.GH_TOKEN }}