-
Notifications
You must be signed in to change notification settings - Fork 23
127 lines (111 loc) · 3.68 KB
/
Copy pathbuild-artifacts.yml
File metadata and controls
127 lines (111 loc) · 3.68 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Build Anki decks and upload artifacts
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: macos-14
strategy:
fail-fast: false
matrix:
language:
- rust
- godot
- sqlite
- wolfram-language
- lua
- c
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-23.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Nix Flake
run: nix flake check
- name: Make Hasklug font visible to tectonic
run: |
# nix develop realizes all dev-shell inputs into /nix/store
nix develop --command true
mkdir -p ~/Library/Fonts
for dir in /nix/store/*-nerd-fonts-hasklug-*/share/fonts; do
[ -d "$dir" ] || continue
find "$dir" -type f \( -name "*.otf" -o -name "*.ttf" \) \
-exec cp -n {} ~/Library/Fonts/ \;
done
echo "Installed fonts:"
ls ~/Library/Fonts/ | grep -i hasklug | head
- name: Build Anki deck and PDF with Nix
run: |
nix develop --command bash -c \
'cd ${{ matrix.language }} && make build'
- name: Rename artifacts
run: |
cp ${{ matrix.language }}/cards.apkg cards-${{ matrix.language }}.apkg
cp ${{ matrix.language }}/cards-with-name.apkg cards-${{ matrix.language }}-with-name.apkg
cp ${{ matrix.language }}/cards.pdf cards-${{ matrix.language }}.pdf
- name: Upload artifacts to workflow run
uses: actions/upload-artifact@v7
with:
name: cards-${{ matrix.language }}
path: |
cards-${{ matrix.language }}.apkg
cards-${{ matrix.language }}-with-name.apkg
cards-${{ matrix.language }}.pdf
if-no-files-found: error
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
cards-${{ matrix.language }}.apkg
cards-${{ matrix.language }}-with-name.apkg
cards-${{ matrix.language }}.pdf
combined:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-23.11
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Make Hasklug font visible to tectonic
run: |
nix develop --command true
mkdir -p ~/Library/Fonts
for dir in /nix/store/*-nerd-fonts-hasklug-*/share/fonts; do
[ -d "$dir" ] || continue
find "$dir" -type f \( -name "*.otf" -o -name "*.ttf" \) \
-exec cp -n {} ~/Library/Fonts/ \;
done
echo "Installed fonts:"
ls ~/Library/Fonts/ | grep -i hasklug | head
- name: Build combined Anki deck and PDF with Nix
run: |
nix develop --command bash -c 'make build-combined'
- name: Upload combined artifacts to workflow run
uses: actions/upload-artifact@v7
with:
name: cards-combined
path: |
cards-combined.apkg
cards-combined.pdf
if-no-files-found: error
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
cards-combined.apkg
cards-combined.pdf