|
38 | 38 | - name: pre-commit-check
|
39 | 39 | run: |
|
40 | 40 | nix build -L .#pre-commit-check
|
| 41 | + live-wasm: |
| 42 | + needs: lint |
| 43 | + name: Build Ormolu WASM |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v3 |
| 47 | + - uses: cachix/install-nix-action@v18 |
| 48 | + with: |
| 49 | + extra_nix_config: | |
| 50 | + accept-flake-config = true |
| 51 | + - uses: actions/cache@v3 |
| 52 | + with: |
| 53 | + path: | |
| 54 | + ~/.ghc-wasm/.cabal/store |
| 55 | + ormolu-live/dist-newstyle |
| 56 | + key: wasm-${{ github.run_id }} |
| 57 | + restore-keys: | |
| 58 | + wasm-${{ github.run_id }} |
| 59 | + wasm- |
| 60 | + - name: Build Ormolu WASM |
| 61 | + run: | |
| 62 | + cd ormolu-live |
| 63 | + nix develop .#ghcWasm -c sh -c \ |
| 64 | + 'wasm32-wasi-cabal update && ./build-wasm.sh -Oz' |
| 65 | + - uses: actions/upload-artifact@v3 |
| 66 | + with: |
| 67 | + name: wasm |
| 68 | + path: ormolu-live/src/ormolu.wasm |
| 69 | + live-frontend: |
| 70 | + needs: lint |
| 71 | + name: Build Ormolu Live frontend |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v3 |
| 75 | + - uses: cachix/install-nix-action@v18 |
| 76 | + with: |
| 77 | + extra_nix_config: | |
| 78 | + accept-flake-config = true |
| 79 | + - name: Build frontend |
| 80 | + run: | |
| 81 | + nix build -L .#ormoluLive |
| 82 | + cp -r --no-preserve=mode,ownership result/ site |
| 83 | + - uses: actions/upload-artifact@v3 |
| 84 | + with: |
| 85 | + name: frontend |
| 86 | + path: site/ |
| 87 | + live-deploy: |
| 88 | + needs: [live-wasm, live-frontend] |
| 89 | + name: Deploy Ormolu Live |
| 90 | + runs-on: ubuntu-latest |
| 91 | + env: |
| 92 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 93 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 94 | + steps: |
| 95 | + - uses: actions/download-artifact@v3 |
| 96 | + - name: Combine |
| 97 | + run: | |
| 98 | + cp wasm/ormolu.wasm frontend/ormolu.*.wasm |
| 99 | + - uses: geekyeggo/delete-artifact@v2 |
| 100 | + with: |
| 101 | + name: | |
| 102 | + wasm |
| 103 | + frontend |
| 104 | + - name: Deploy to Netlify, preview |
| 105 | + if: env.NETLIFY_AUTH_TOKEN != '' |
| 106 | + uses: nwtgck/actions-netlify@v2 |
| 107 | + with: |
| 108 | + publish-dir: ./frontend |
| 109 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 110 | + alias: ${{ github.event.pull_request.head.sha || github.sha }} |
| 111 | + enable-pull-request-comment: true |
| 112 | + enable-commit-comment: false |
| 113 | + enable-commit-status: true |
| 114 | + - name: Deploy to Netlify, production |
| 115 | + if: env.NETLIFY_AUTH_TOKEN != '' && github.ref == 'refs/heads/master' |
| 116 | + run: | |
| 117 | + netlify deploy --prod -d ./frontend |
0 commit comments