-
Notifications
You must be signed in to change notification settings - Fork 4
89 lines (81 loc) · 2.79 KB
/
examples.yml
File metadata and controls
89 lines (81 loc) · 2.79 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
name: examples
on:
push:
branches:
- main
paths-ignore:
- "README.md"
- "LICENSE"
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
# Not using non-official GitHub Actions for security reasons.
steps:
- uses: actions/checkout@v4
- run: rustup update stable
- run: rustup default stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-examples-${{ hashFiles('**/Cargo.lock') }}
- run: sudo apt-get install -y ffmpeg
- run: sudo apt-get install -y imagemagick
- run: cargo install --debug --path .
- run: |
echo "DEEPINFRA_KEY=${{ secrets.DEEPINFRA_KEY }}" > keys.env
echo "GOOGLE_KEY=${{ secrets.GOOGLE_KEY }}" >> keys.env
- run: cargo install --debug jas@0.3.0
- run: >
jas install --gh typst/typst@v0.13.1
--sha 7d214bfeffc2e585dc422d1a09d2b144969421281e8c7f5d784b65fc69b5673f
--gh-token ${{ secrets.GITHUB_TOKEN }}
- run: |
mkdir _public
echo "<html><body><h1>Home page for the examples</h1></body></html>" > _public/index.html
- name: Run examples
run: |
convert -size 500x500 xc:none -fill white -draw "polygon 150,100 150,400 400,250" play_button.png
./examples/demo.sh
mv _out/out.mp4 _public/demo.mp4
convert _out/image/1.png play_button.png -gravity center -composite tmp.png
mv tmp.png _public/demo.png
./examples/google.sh
mv _out/out.mp4 _public/google.mp4
convert _out/image/1.png play_button.png -gravity center -composite tmp.png
mv tmp.png _public/google.png
./examples/first.sh
mv _out/out.mp4 _public/first.mp4
convert _out/image/1.png play_button.png -gravity center -composite tmp.png
mv tmp.png _public/first.png
./examples/zonos.sh
mv _out/out.mp4 _public/zonos.mp4
convert _out/image/1.png play_button.png -gravity center -composite tmp.png
mv tmp.png _public/zonos.png
- name: Cleanup
run: rm keys.env
- name: Upload static files
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: _public/
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
timeout-minutes: 15
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- uses: actions/deploy-pages@v4
id: deployment