-
Notifications
You must be signed in to change notification settings - Fork 217
130 lines (108 loc) · 3.71 KB
/
deploy_website.yaml
File metadata and controls
130 lines (108 loc) · 3.71 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Deploy To GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
jobs:
deploy-main:
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --immutable
# If on main without env vars, build with .env file
- name: Build with .env file
if: ${{ vars.VITE_STORAGE_ENGINE == '' }}
run: yarn build
# If on main with env vars, build with github environment variables
- name: Build with github environment variables
if: ${{ vars.VITE_STORAGE_ENGINE != '' }}
run: VITE_STORAGE_ENGINE=$VITE_STORAGE_ENGINE yarn build
env:
VITE_STORAGE_ENGINE: ${{ vars.VITE_STORAGE_ENGINE }}
- uses: peaceiris/actions-gh-pages@v3
name: Deploy
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
deploy-dev:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/dev'}}
permissions:
contents: write
concurrency:
group: dev-deploy
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --immutable
- name: Build dev branch
run: VITE_BASE_PATH=/dev yarn build
env:
VITE_BASE_PATH: "/dev/"
- uses: peaceiris/actions-gh-pages@v3
name: Deploy dev branch
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: "dev"
pr-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
steps:
- name: Comment on PR
uses: hasura/comment-progress@v2.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "Starting deployment of preview ⏳..."
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
- run: yarn install --immutable
# Build with github environment variables
- name: Build with github environment variables
if: ${{ vars.VITE_STORAGE_ENGINE != '' }}
run: VITE_STORAGE_ENGINE=$VITE_STORAGE_ENGINE VITE_BASE_PATH=$VITE_BASE_PATH yarn build
env:
VITE_STORAGE_ENGINE: ${{ vars.VITE_STORAGE_ENGINE }}
VITE_BASE_PATH: "/study/PR${{ github.event.number }}/"
- name: Push PR deploy preview
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: "PR${{ github.event.number }}"
- name: Update comment
uses: hasura/comment-progress@v2.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ https://revisit.dev/study/PR${{ github.event.number }} ✨\n\nChanges may take a few minutes to propagate."