-
Notifications
You must be signed in to change notification settings - Fork 55
91 lines (75 loc) · 2.78 KB
/
pr-demo.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
81
82
83
84
85
86
87
88
89
90
91
name: PR demo CI
on:
pull_request:
push:
branches: [master]
permissions:
contents: read
deployments: read
pull-requests: write # needed to write a comment
statuses: write
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
name: Build demo and deploy it
environment: pull_request_unsafe
steps:
- name: Checkout sources
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
- name: Use Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 18
registry-url: "https://registry.npmjs.org/"
scope: "@talend"
cache: "yarn"
- name: cache for storybook
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
with:
path: packages/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install
run: |
yarn install --frozen-lockfile
yarn global add surge
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Build
run: |
yarn test:demo
./.github/workflows/before-surge.sh
env:
STORYBOOK_FIGMA_ACCESS_TOKEN: ${{ secrets.STORYBOOK_FIGMA_ACCESS_TOKEN }}
- name: deploy if master
if: github.ref == 'refs/heads/master'
run: surge --project .static --domain "talend.surge.sh"
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: Deploy to Netlify production
if: github.ref == 'refs/heads/master'
uses: netlify/actions/cli@master
with:
args: deploy --prod --dir=packages/storybook/storybook-static
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: deploy if PR
if: github.ref != 'refs/heads/master'
run: |
surge --project .static --domain "${{ github.event.number }}.talend.surge.sh"
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: Comment PR
uses: daohoangson/comment-on-github@v2
if: ${{github.event_name == 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ":octocat: [Demo is available here](http://${{ github.event.number }}.talend.surge.sh)"
fingerprint: ${{ github.event.number }}
replace: please