Include PDF in workflow artifacts and release uploads #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Anki decks and upload artifacts | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*.*.*" | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: macos-14 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| language: | |
| - rust | |
| - godot | |
| - sqlite | |
| - wolfram-language | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - 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: 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.pdf cards-${{ matrix.language }}.pdf | |
| - name: Upload artifacts to workflow run | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cards-${{ matrix.language }} | |
| path: | | |
| cards-${{ matrix.language }}.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 }}.pdf |