Adding GHCup targets for build, update, serve #133
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 and deploy | |
| on: | |
| push: | |
| branches: main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: ners/simply-nix@main | |
| with: | |
| reclaim_space: true | |
| - uses: actions/checkout@v4 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install cachix | |
| uses: cachix/cachix-action@v16 | |
| with: | |
| name: haskell-miso-cachix | |
| - name: Build WASM using Nix | |
| run: nix develop .#wasm --command bash -c "make" | |
| - name: Clean and GC | |
| run: | | |
| nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d | |
| make clean | |
| - name: Build JS using Nix | |
| run: nix develop .#ghcjs --command bash -c "make js" | |
| - name: Install GHCup | |
| uses: haskell/ghcup-setup@v1 | |
| with: | |
| cabal: latest | |
| - name: Build using GHCup WASM | |
| run: | | |
| make ghcup-build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./public | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |