Repository navigation
114 lines (97 loc) · 4.15 KB
/
Copy pathdeploy.yml
File metadata and controls
114 lines (97 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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, wasm-pack and binaryen (wasm-opt), which is what
# `comline-simulator`'s and `comline-web-kit`'s `prepack`s need to build
# their 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 editor and simulate view) is a git
# dependency, and so is the sim's engine, `comline-simulator`. Both
# compile to WASM in their `prepack`: the kit builds the editor (the
# compiler and language server) with wasm-pack, the simulator with
# wasm-bindgen. 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.
# (`yarn-editor-`: caches from before the tutorial used the editor hold a
# kit packed without it, so they're never restored.)
- name: Cache yarn
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.yarn/berry/cache
key: ${{ runner.os }}-${{ runner.arch }}-yarn-editor-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-yarn-editor-
# Yarn's `npmMinimalAgeGate` (its default, one day) stays on.
- name: Install dependencies
env:
COMLINE_SIMULATOR_SCRIPT: '0' # the tutorial only needs the lean sim
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