mirror of
https://github.com/storytold/egui.git
synced 2026-11-23 07:50:16 +00:00
faa2876b9f
Each third-party action that StepSecurity publishes a secure drop-in replacement for now uses that replacement, pinned to a commit with its version as a comment. Versions follow what we used: the newest StepSecurity release in the same major, or the closest major they publish. dtolnay/rust-toolchain refs that named a toolchain (stable, nightly, 1.76) become the replacement's `toolchain` input.
66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
# This action builds and deploys egui_demo_app on each pull request created
|
|
# Security notes:
|
|
# The preview deployment is split in two workflows, preview_build and preview_deploy.
|
|
# `preview_build` runs on pull_request, so it won't have any access to the repositories secrets, so it is safe to
|
|
# build / execute untrusted code.
|
|
# `preview_deploy` has access to the repositories secrets (so it can push to the pr preview repo) but won't run
|
|
# any untrusted code (it will just extract the build artifact and push it to the pages branch where it will
|
|
# automatically be deployed).
|
|
|
|
name: Preview Build
|
|
|
|
on:
|
|
- pull_request
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@v4
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: 1.95.0
|
|
targets: wasm32-unknown-unknown
|
|
- uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
|
|
with:
|
|
prefix-key: "pr-preview-"
|
|
|
|
- name: Install wasm-opt
|
|
uses: sigoden/install-binary@v1
|
|
with:
|
|
repo: WebAssembly/binaryen
|
|
tag: version_123
|
|
name: wasm-opt
|
|
|
|
- run: |
|
|
scripts/build_demo_web.sh --release
|
|
|
|
- name: Remove gitignore file
|
|
# We need to remove the .gitignore, otherwise the deploy via git will not include the js and wasm files
|
|
run: |
|
|
rm -rf web_demo/.gitignore
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web_demo
|
|
path: web_demo
|
|
|
|
- name: Generate meta.json
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
URL_SLUG: ${{ github.event.number }}-${{ github.head_ref }}
|
|
run: |
|
|
# Sanitize the URL_SLUG to only contain alphanumeric characters and dashes
|
|
URL_SLUG=$(echo $URL_SLUG | tr -cd '[:alnum:]-')
|
|
echo "{\"pr_number\": \"$PR_NUMBER\", \"url_slug\": \"$URL_SLUG\"}" > meta.json
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: meta.json
|
|
path: meta.json
|