-
Notifications
You must be signed in to change notification settings - Fork 57
77 lines (65 loc) · 1.89 KB
/
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
name: Deploy preview
on:
push:
branches:
- preview
jobs:
cancel-previous:
name: 'Cancel Previous Runs'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
deploy-application:
services:
postgres:
image: postgres
env:
POSTGRES_DB: 'origin'
POSTGRES_PASSWORD: 'postgres'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 10s
--health-retries 10
ports:
- 5432:5432
runs-on: ubuntu-latest
needs: cancel-previous
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: "Generate unique id"
id: generate_unique_id
uses: ./.github/actions/build_id
- name: Restore timestamp
run: |
sh scripts/restore-original-timestamps.sh
- name: Install application
# lerna doesn't work without additional fetch
run: |
git fetch origin master:master
node common/scripts/install-run-rush.js install
- name: Build application
run: |
node common/scripts/install-run-rush.js build
- name: Set creds to npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> $HOME/.npmrc
- name: Login into docker hub
run: |
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin
- name: Preview application
run: |
yarn publish:preview
env:
BUILD_ID: ${{steps.generate_unique_id.outputs.unique_id}}