Repository navigation
91 lines (77 loc) · 2.44 KB
/
Copy pathdeploy.yml
File metadata and controls
91 lines (77 loc) · 2.44 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
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
87
88
89
90
91
name: Deploy
# Rebuilds the site and publishes it to GitHub Pages. The daily run only
# rebuilds when the language repository has a commit the live site wasn't
# built from (the site's /build.json records it); pushes here and manual runs
# always rebuild.
on:
schedule:
- cron: "17 3 * * *"
push:
branches: [master]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
env:
UPSTREAM: https://github.com/lambda-discipline/lambda-discipline
UPSTREAM_BRANCH: master
SITE: https://lambda-discipline.github.io
jobs:
check:
name: Check for changes
runs-on: ubuntu-latest
outputs:
build: ${{ steps.compare.outputs.build }}
steps:
- id: compare
run: |
upstream=$(git ls-remote "$UPSTREAM" "refs/heads/$UPSTREAM_BRANCH" | cut -f1)
deployed=$(curl -fsSL "$SITE/build.json" | jq -r '.commit // empty' || true)
echo "upstream: $upstream"
echo "deployed: ${deployed:-none}"
if [ "$GITHUB_EVENT_NAME" != "schedule" ] || [ "$upstream" != "$deployed" ]; then
echo "build=true" >> "$GITHUB_OUTPUT"
else
echo "build=false" >> "$GITHUB_OUTPUT"
echo "The site is already up to date." >> "$GITHUB_STEP_SUMMARY"
fi
build:
name: Build
needs: check
if: needs.check.outputs.build == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Clone the language repository
run: git clone --depth 1 --branch "$UPSTREAM_BRANCH" "$UPSTREAM" .cache/lambda-discipline
- name: Install Rust
# Installs the version the language repository's rust-toolchain.toml asks for.
working-directory: .cache/lambda-discipline
run: rustup toolchain install
- uses: Swatinem/rust-cache@v2
with:
workspaces: .cache/lambda-discipline
- uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: pip
- run: pip install -r requirements.txt
- name: Build the site
run: python build.py --no-update
- uses: actions/upload-pages-artifact@v5
with:
path: _site
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5