Feature/auto snap #260
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
# https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} | |
permissions: {} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Lint | |
run: pnpm lint | |
- name: Format check | |
run: pnpm format --check | |
# - name: Test | |
# run: pnpm test | |
build-demo: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build --base /${{ github.event.repository.name }}/ | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist/ | |
deploy-demo: | |
needs: [build-demo] | |
if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v4 | |
release: | |
needs: [build-demo] # Semantically, this job can be run just after test, but we wait for build-demo to ensure the build is successful. | |
if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write # Necessary for provenance: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Package and Publish | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm ci:publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |