fix: setup build dependencies #17
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: | |
| workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | |
| push: # Runs whenever a commit is pushed to the repository | |
| branches: [experience-cs] | |
| permissions: | |
| contents: write # publish a GitHub release | |
| pages: write # deploy to GitHub Pages | |
| issues: write # comment on released issues | |
| pull-requests: write # comment on released pull requests | |
| packages: write # deploy to GitHub Packages | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.compare || github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Detect affected packages, build and test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 | |
| with: | |
| cache: "npm" | |
| node-version-file: ".nvmrc" | |
| - uses: wagoid/commitlint-github-action@9763196e10f27aef304c9b8b660d31d97fce0f99 # v5 | |
| - name: Debug info | |
| run: | | |
| cat <<EOF | |
| Scratch environment: ${{ vars.SCRATCH_ENV || '<none>' }} | |
| Node version: $(node --version) | |
| NPM version: $(npm --version) | |
| GitHub ref: ${{ github.ref }} | |
| GitHub head ref: ${{ github.head_ref }} | |
| Working directory: $(pwd) | |
| EOF | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| - name: Build and test scratch-gui | |
| working-directory: ./packages/scratch-gui | |
| run: | | |
| npm run build | |
| npm run test | |
| - name: Publish scratch-gui to GitHub Packages | |
| working-directory: ./packages/scratch-gui | |
| run: | | |
| RELEASE_VERSION="0.1.0-experience-cs.$(date +'%Y%m%d%H%M%S')" | |
| npm version --no-git-tag-version $RELEASE_VERSION | |
| npm publish --access public --tag latest |