fix: provide NPM_AUTH_TOKEN #29
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 | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.compare || github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Detect affected packages, build, test and publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 | |
| with: | |
| cache: "npm" | |
| node-version-file: ".nvmrc" | |
| registry-url: "https://npm.pkg.github.com" | |
| - 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 | |
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 | |
| id: filter | |
| with: | |
| # Files in the `global` filter affect all workspaces, even if workspace-specific files have not changed. | |
| filters: | | |
| global: | |
| - ".github/workflows/ci.yml" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "scripts/**" | |
| any-workspace: | |
| - "packages/**" | |
| scratch-svg-renderer: | |
| - "packages/scratch-svg-renderer/**" | |
| scratch-render: | |
| - "packages/scratch-render/**" | |
| - "packages/scratch-svg-renderer/**" | |
| scratch-vm: | |
| - "packages/scratch-render/**" | |
| - "packages/scratch-svg-renderer/**" | |
| - "packages/scratch-vm/**" | |
| scratch-gui: | |
| - "packages/scratch-gui/**" | |
| - "packages/scratch-render/**" | |
| - "packages/scratch-svg-renderer/**" | |
| - "packages/scratch-vm/**" | |
| - if: ${{ steps.filter.outputs.global == 'true' || steps.filter.outputs.any-workspace == 'true' }} | |
| env: | |
| NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for downloading private npm packages | |
| uses: ./.github/actions/install-dependencies | |
| - name: Build packages | |
| if: ${{ steps.filter.outputs.global == 'true' || steps.filter.outputs.any-workspace == 'true' }} | |
| run: npm run build | |
| # - name: Test scratch-svg-renderer | |
| # if: ${{ !cancelled() && (steps.filter.outputs.global == 'true' || steps.filter.outputs.scratch-svg-renderer == 'true') }} | |
| # uses: ./.github/actions/test-package | |
| # with: | |
| # package_name: scratch-svg-renderer | |
| # - name: Test scratch-render | |
| # if: ${{ !cancelled() && (steps.filter.outputs.global == 'true' || steps.filter.outputs.scratch-render == 'true') }} | |
| # uses: ./.github/actions/test-package | |
| # with: | |
| # package_name: scratch-render | |
| # - name: Test scratch-vm | |
| # if: ${{ !cancelled() && (steps.filter.outputs.global == 'true' || steps.filter.outputs.scratch-vm == 'true') }} | |
| # uses: ./.github/actions/test-package | |
| # with: | |
| # package_name: scratch-vm | |
| # - name: Test scratch-gui | |
| # if: ${{ !cancelled() && (steps.filter.outputs.global == 'true' || steps.filter.outputs.scratch-gui == 'true') }} | |
| # uses: ./.github/actions/test-package | |
| # with: | |
| # package_name: scratch-gui | |
| - name: Publish scratch-gui to GitHub Packages | |
| working-directory: ./packages/scratch-gui | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for publishing private npm packages | |
| NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for viewing private npm packages | |
| 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 |