chore(deps): update actions/checkout action to v4.2.0 (#4127) #982
This file contains 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: Repository dispatch on main | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
actions: write | |
env: | |
BIOME_WEBSITE_REPO: biomejs/website | |
BIOME_PUSH_ON_MAIN_EVENT_TYPE: biome-push-on-main-event | |
WASM_PACK_CACHE_KEY: wasm-pack-cache | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-wasm: | |
name: Build @biomejs/wasm-web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Warm up wasm-pack cache | |
id: cache-restore | |
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
./target | |
./packages/@biomejs/wasm-web | |
key: ${{ env.WASM_PACK_CACHE_KEY }} | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build WASM module for the web | |
run: wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --profiling --scope biomejs crates/biome_wasm --features experimental-html,experimental-grit | |
# https://github.com/actions/cache/issues/342 | |
- name: Clear old wasm-pack cache | |
if: ${{ steps.cache-restore.outputs.cache-hit }} | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete ${{ env.WASM_PACK_CACHE_KEY }} --confirm | |
env: | |
GH_TOKEN: ${{ github.token }} | |
continue-on-error: true | |
- name: Save new wasm-pack cache | |
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
./target | |
./packages/@biomejs/wasm-web | |
key: ${{ env.WASM_PACK_CACHE_KEY }} | |
- name: Install pnpm | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Update package.json | |
working-directory: packages/@biomejs/wasm-web | |
run: | | |
npm pkg set name='@biomejs/wasm-web' | |
npm pkg set version='0.0.0-rev.${{ github.event.head_commit.id }}' | |
- name: Publish | |
working-directory: packages/@biomejs/wasm-web | |
run: pnpx pkg-pr-new publish | |
repository-dispatch: | |
name: Repository dispatch | |
needs: build-wasm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dispatch event on push | |
if: ${{ github.event_name == 'push' }} | |
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | |
with: | |
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }} | |
repository: ${{ env.BIOME_WEBSITE_REPO }} | |
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }} | |
client-payload: '{"event": ${{ toJson(github.event) }}}' | |
# For testing only, the payload is mocked | |
- name: Dispatch event on workflow dispatch | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3 | |
with: | |
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }} | |
repository: ${{ env.BIOME_WEBSITE_REPO }} | |
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }} | |
client-payload: '{"event": {"head_commit": {"id": "${{ env.GITHUB_SHA }}"}}}' |