-
Notifications
You must be signed in to change notification settings - Fork 25
71 lines (60 loc) · 2.3 KB
/
build.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
name: Build sample material
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
- name: Install tools
uses: taiki-e/install-action@v2
with:
- name: Add mdslides
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrous-systems/mdslides/releases/download/v0.4.0/mdslides-installer.sh | sh
- name: Add Rust Targets
run: |
rustup target add thumbv7em-none-eabihf
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrocene/criticalup/releases/download/v1.1.0/criticalup-installer.sh | sh
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build book-and-slides
env:
CRITICALUP_TOKEN: ${{ secrets.CRITICALUP_TOKEN }}
run: |
cd ./training-slides && ./build.sh
- name: Build example code
env:
CRITICALUP_TOKEN: ${{ secrets.CRITICALUP_TOKEN }}
run: |
cd ./example-code && ./build.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
mv ./training-slides/slides ./rust-training-${{ env.slug }}/training-slides-presentation
mv ./training-slides/book ./rust-training-${{ env.slug }}/training-slides-book
cp -r ./example-code ./rust-training-${{ env.slug }}
echo "Compressing ./rust-training-${{ env.slug }}.zip..."
zip -r ./rust-training-${{ env.slug }}.zip ./rust-training-${{ env.slug }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Artifacts
if-no-files-found: error
path: |
./rust-training-*/
- name: Create and Upload Release
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: ./rust-training-${{ env.slug }}.zip