Repository navigation
Try it: run the lesson on the playground's simulate view #26
Workflow file for this run
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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| # A newer push to the same pull request supersedes this run; a branch's runs | |
| # queue instead, so a deploy that is already running is never cancelled. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| # Container jobs default to `sh`; the steps are bash. | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # Runs on pull requests too, so a pull request shows the site builds. Only | |
| # the artifact upload and the deploy job below are gated to main. | |
| build_site: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 | |
| # The wasm CI image: Rust stable 1.99.1 with the wasm32 targets, | |
| # wasm-bindgen 0.2.127 and binaryen (wasm-opt), which is what | |
| # `comline-simulator`'s `prepack` needs to build its WASM. | |
| container: ghcr.io/comlineproject/ci-wasm@sha256:74efbad4c8b06d554d28e8a1e486f12ae5b6b4bd15a15db21a0925e020caa40a | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: 24.22.3 | |
| # `.yarnrc.yml` points `yarnPath` at the committed Yarn release; | |
| # corepack provides the `yarn` command that hands over to it. | |
| - name: Yarn | |
| run: corepack enable | |
| # `comline-web-kit` (the playground's simulate view) is a git dependency, | |
| # and so is its engine, `comline-simulator`, which compiles to WASM in | |
| # its `prepack` (Rust to wasm-bindgen). The image has cargo, wasm-bindgen | |
| # and wasm-opt; this caches the registry and git checkouts across runs. | |
| - name: Cache cargo | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| /usr/local/cargo/registry | |
| /usr/local/cargo/git | |
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('yarn.lock') }} | |
| restore-keys: ${{ runner.os }}-${{ runner.arch }}-cargo- | |
| # Yarn Berry's global cache holds the packed `comline-web-kit` and the | |
| # built `comline-simulator` archives: a hit skips the Rust build entirely. | |
| - name: Cache yarn | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.yarn/berry/cache | |
| key: ${{ runner.os }}-${{ runner.arch }}-yarn-${{ hashFiles('yarn.lock') }} | |
| restore-keys: ${{ runner.os }}-${{ runner.arch }}-yarn- | |
| # Yarn's `npmMinimalAgeGate` (its default, one day) stays on. | |
| - name: Install dependencies | |
| env: | |
| COMLINE_SIMULATOR_SCRIPT: '0' # the tutorial only needs the lean sim | |
| COMLINE_KIT_EDITOR: '0' # and not the kit's editor WASM | |
| run: yarn install | |
| - name: build | |
| env: | |
| BASE_PATH: '/${{ github.event.repository.name }}' | |
| run: yarn build | |
| - name: Upload Artifacts | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| # this should match the `pages` option in your adapter-static options | |
| path: 'build/' | |
| deploy: | |
| needs: build_site | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit | |
| - name: Deploy | |
| id: deployment | |
| uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 |