-
Notifications
You must be signed in to change notification settings - Fork 46
86 lines (70 loc) · 2.09 KB
/
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
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
name: Publish website
on:
schedule:
- cron: '0 */6 * * *'
push:
branches: [ main ]
workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install packages
run: npm i
- name: Generate Site
run: npm run build
- name: Store PR id
run: |
mkdir pr
echo ${{ github.event.number }} > ./pr/pr-id.txt
- name: Upload PR id as artifact
uses: actions/upload-artifact@v4
with:
name: pr-id
path: pr
retention-days: 1
- name: Upload site as artifact
uses: actions/upload-artifact@v4
with:
name: site
path: build/site
retention-days: 1
deploy:
# Only try and deploy on merged code
if: "github.repository == 'quarkiverse/quarkiverse-docs' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')"
needs: [ build ]
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
runs-on: ubuntu-latest
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4 # not needed for the code, but needed for the git config
- name: Download Built site
uses: actions/download-artifact@v4
with:
name: site
path: _site
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4