-
Notifications
You must be signed in to change notification settings - Fork 33
97 lines (96 loc) · 3.28 KB
/
push.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
87
88
89
90
91
92
93
94
95
96
97
on:
- push
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Install dependencies
run: |
curl -Ls https://github.com/jgm/pandoc/releases/download/2.11.2/pandoc-2.11.2-1-amd64.deb -o pandoc.deb
sudo dpkg -i pandoc.deb
sudo apt-get install nasm
sudo apt-get install fonts-stix
sudo apt-get install libunistring-dev
- name: Install Racket
uses: Bogdanp/[email protected]
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: '8.14'
- name: Install a86 and langs
run: |
git clone https://github.com/cmsc430/a86.git
git clone https://github.com/cmsc430/langs.git
raco pkg install --auto a86/
raco pkg install --auto langs/
- name: Build and test
run: |
export LINK_DIR=/usr/lib/x86_64-linux-gnu
# raco pkg install --auto www/
raco make www/main.scrbl
make -C www main
- name: Generate assignment zips
env:
GITHUB_TOKEN: ${{ secrets.PAT_ZIPS_WORKFLOW }}
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/cmsc430/assignments/actions/workflows/push.yml/dispatches \
-d '{"ref":"main"}'
- name: Get zips run ID
env:
GITHUB_TOKEN: ${{ secrets.PAT_ZIPS_WORKFLOW }}
run: |
sleep 60 # give chance to finish
response=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/cmsc430/assignments/actions/runs?branch=main&status=success&per_page=1")
echo "Run response: $response"
run_id=$(echo "$response" | jq -r '.workflow_runs[0].id')
echo "RUN_ID=$run_id" >> $GITHUB_ENV
- name: Download assignment zips
env:
GITHUB_TOKEN: ${{ secrets.PAT_ZIPS_WORKFLOW }}
run: |
response=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/cmsc430/assignments/actions/runs/${{ env.RUN_ID }}/artifacts)
echo "Run response: $response"
download_url=$(echo "$response" | jq -r '.artifacts[0].archive_download_url')
echo "Download URL: $download_url"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GITHUB_TOKEN" \
$download_url
-o artifacts.zip
- name: Extract assignment zips
if: success()
run: |
unzip -l artifacts.zip
# tar -xvf artifact.tar
# mv knock-plus.zip www/main/
- name: Archive www
uses: actions/upload-pages-artifact@v4
with:
name: github-pages
path: www/main
deploy:
needs: build-and-test
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub pages
id: deployment
uses: actions/deploy-pages@v4