Skip to content

Commit 5cfe2eb

Browse files
committed
Add combined Anki deck artifact to CI
Build a single "Coding Flashcards" deck containing every language's cards and upload it as its own workflow artifact (and release asset on tagged builds).
1 parent 4bcc0b0 commit 5cfe2eb

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/build-artifacts.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,32 @@ jobs:
7272
files: |
7373
cards-${{ matrix.language }}.apkg
7474
cards-${{ matrix.language }}.pdf
75+
76+
combined:
77+
runs-on: macos-14
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v6
81+
82+
- name: Install Nix
83+
uses: cachix/install-nix-action@v26
84+
with:
85+
nix_path: nixpkgs=channel:nixos-23.11
86+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
87+
88+
- name: Build combined Anki deck with Nix
89+
run: |
90+
nix develop --command bash -c 'make build-combined'
91+
92+
- name: Upload combined deck to workflow run
93+
uses: actions/upload-artifact@v7
94+
with:
95+
name: cards-combined
96+
path: cards-combined.apkg
97+
if-no-files-found: error
98+
99+
- name: Release
100+
if: startsWith(github.ref, 'refs/tags/v')
101+
uses: softprops/action-gh-release@v2
102+
with:
103+
files: cards-combined.apkg

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.direnv
2+
cards-combined.md
3+
cards-combined.apkg

makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ build:
1111
cd wolfram-language && make build
1212

1313

14+
cards-combined.md: rust/cards.md godot/cards.md sqlite/cards.md wolfram-language/cards.md
15+
printf -- '---\nname: Coding Flashcards\n---\n' > $@
16+
for f in $^; do \
17+
dir=$$(dirname "$$f"); \
18+
awk -v dir="$$dir" 'BEGIN{seen=0} \
19+
/^---$$/ && seen<2 {seen++; next} \
20+
seen>=2 {gsub(/\.\/images\//, "images/"); gsub(/images\//, dir "/images/"); print}' \
21+
"$$f" >> $@; \
22+
done
23+
24+
25+
cards-combined.apkg: cards-combined.md
26+
anki-panky $<
27+
28+
29+
.PHONY: build-combined
30+
build-combined: cards-combined.apkg
31+
32+
1433
.PHONY: test
1534
test:
1635
cd rust && make test
@@ -21,6 +40,7 @@ test:
2140

2241
.PHONY: clean
2342
clean:
43+
rm -f cards-combined.md cards-combined.apkg
2444
cd rust && make clean
2545
cd godot && make clean
2646
cd sqlite && make clean

0 commit comments

Comments
 (0)