-
Notifications
You must be signed in to change notification settings - Fork 19
48 lines (47 loc) · 1.37 KB
/
auto-publish.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
name: CI
on:
pull_request_target:
types: [opened, reopened, synchronize]
push:
branches-ignore:
- 'gh-pages'
jobs:
build:
name: Build and Validate
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
path: out/
deploy:
name: Deploy
needs: build
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/download-artifact@v4
if: success() || failure()
- run: cp -r ./artifact/. .
if: github.ref_name == 'main'
- run: mkdir -p pr && cp -r ./artifact/. ./pr/${{ github.event.number }}
if: github.event_name != 'push'
- run: mkdir -p branch && cp -r ./artifact/. ./branch/${{ github.ref_name }}
if: github.event_name == 'push' && github.ref_name != 'main'
- run: rm -r artifact
- name: Configure git
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Push to gh-pages
run: |
git add .
git commit -m "Deploy ${{ github.event_name }} ${{ github.ref_name }}" --allow-empty
git push