forked from pearcej/opensource
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (61 loc) · 1.69 KB
/
build.yml
File metadata and controls
61 lines (61 loc) · 1.69 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
name: "PreTeXt"
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build:
name: "Compile"
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # Required for v4 artifact system
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: Setup GitHub Pages
id: pages
uses: actions/configure-pages@v3
if: github.ref == 'refs/heads/main'
- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: "Install PreTeXt"
run: pip install -r requirements.txt
- name: "Compile book"
run: pretext build web
- name: Package website
if: github.ref == 'refs/heads/main'
# Create a tar archive for GitHub Pages
run: |
cd output/web
tar --dereference --hard-dereference -cf $RUNNER_TEMP/artifact.tar .
cd -
- name: Upload GitHub Pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4 # Use v4 directly
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error
deploy:
name: "Publish"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build
permissions:
pages: write
id-token: write
actions: read # Required for v4 artifact system
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4