-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (76 loc) · 2.7 KB
/
deploy-gh-pages.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: Build and Deploy to GitHub Pages
on:
# trigger manually for now
workflow_dispatch:
# push:
# branches:
# - master
jobs:
build:
runs-on: ["runs-on","runner=2cpu-linux-x64","image=ubuntu24-amd64"]
steps:
# Checkout the main repository
- name: Checkout this repository
uses: actions/checkout@v3
with:
ref: master
# Checkout the ZML repository into a separate folder
- name: Checkout ZML repository
uses: actions/checkout@v3
with:
repository: zml/zml
token: ${{ secrets.ORG_PAT }}
path: zml
ref: master
- name: test curlit
run: |
curl -L -o /tmp/test.tar.xz https://mirror.zml.ai/zig/zig-linux-x86_64-0.13.0.tar.xz?source=github-actions
ls -alih /tmp/test.tar.xz
tar -tf /tmp/test.tar.xz
# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
# Set up Zig
- uses: mlugg/setup-zig@v1
with:
version: 0.13.0
mirror: 'https://mirror.zml.ai/zig'
# Run scripts to build the static website with Zine
- name: Run build scripts
run: |
./01-PREPARE-FOR-EDITS.sh
eval "$(ssh-agent -s)"
ssh-keyscan -t ed25519 github.com > ~/.ssh/known_hosts
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
./02-BUILD.sh
# Checkout the docs branch
- name: Checkout the docs branch
uses: actions/checkout@v3
with:
ref: docs # The branch that will hold the generated GitHub Pages content
path: gh-pages # Work in a separate directory to avoid conflicts
# probably don't need the token - but the branch must exist
token: ${{ secrets.ORG_PAT }}
# Copy the generated files to the docs branch
- name: Copy generated files
run: |
cp -r WORKSPACE/zig-out/* gh-pages/
# Commit and push changes to the docs branch
- name: Commit and push changes
run: |
cd gh-pages
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
date >> README.md
git add .
git remote add sshtarget [email protected]:zml/docs
eval "$(ssh-agent -s)"
ssh-keyscan -t ed25519 github.com > ~/.ssh/known_hosts
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
git commit -m "Update GitHub Pages"
git push sshtarget docs
# alternative with the x-access url
# but: the token only has read access!!!!
# git push https://x-access-token:${{ secrets.ORG_PAT }}@github.com/zml/zml.git docs