-
Notifications
You must be signed in to change notification settings - Fork 45
50 lines (39 loc) · 1.21 KB
/
github-pages.yml
File metadata and controls
50 lines (39 loc) · 1.21 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
name: GitHub Pages CD
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Retrieve release version
run: |
echo "VERSION=v$(node utils/version.js)" >> $GITHUB_ENV
- name: Ensure version is unique
run: |
git fetch origin "$VERSION" \
&& echo "Version is not unique; exiting..." \
|| echo "UNIQUE_VERSION=1" >> $GITHUB_ENV
- name: Configure Git
if: ${{ env.UNIQUE_VERSION }}
run: git config user.name "GitHub Pages CD"
- name: Install NPM packages
if: ${{ env.UNIQUE_VERSION }}
run: npm install
- name: Compile Webpack project
if: ${{ env.UNIQUE_VERSION }}
run: npm run build
- name: Publish build
if: ${{ env.UNIQUE_VERSION }}
run: |
git add --force dist/
git commit --message 'Publish site'
git subtree split --prefix dist/ --branch gh-pages
git push --force origin gh-pages
- name: Tag commit
if: ${{ env.UNIQUE_VERSION }}
run: |
git tag "$VERSION" gh-pages
git push origin "$VERSION"