⬆️ Update Yarn to v4.5.0 #1298
Workflow file for this run
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: Build Status | |
on: | |
push: | |
branches: | |
- main | |
- next-* | |
- fix-v* | |
tags: | |
- v** | |
pull_request: | |
branches: | |
- main | |
- next-* | |
- fix-v* | |
jobs: | |
warmup_yarn_cache: | |
name: 'Warm up Yarn cache' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node v18.x | |
uses: actions/setup-node@v4 | |
id: yarn-cache | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
- name: Update Yarn cache | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
env: | |
# Using PNP linker for better performance | |
YARN_NODE_LINKER: pnp | |
run: yarn install --immutable | |
format: | |
name: 'Format' | |
needs: warmup_yarn_cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node v18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Check format | |
run: yarn format:check | |
test: | |
name: 'Test' | |
needs: warmup_yarn_cache | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node v${{matrix.node-version}} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node-version}} | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build production package | |
run: yarn build:prod-ci | |
- name: Unit tests | |
run: yarn test | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
name: unit-tests-${{matrix.node-version}}-${{runner.os}} | |
flags: unit-tests, unit-tests-${{matrix.node-version}}-${{runner.os}} | |
fail_ci_if_error: false # default: false | |
verbose: false # default: false | |
test_package_quality: | |
name: 'Test package quality' | |
needs: warmup_yarn_cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node v18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
- name: Check package score using skypack | |
run: yarn dlx @skypack/package-check | |
production_package: | |
name: 'Build production package' | |
needs: warmup_yarn_cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node v18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build production package | |
run: yarn build:prod-ci | |
- name: Create bundle | |
run: yarn pack | |
- name: Upload production package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundle | |
path: package.tgz | |
if-no-files-found: error | |
retention-days: 1 | |
test_legacy: | |
name: 'Test legacy' | |
needs: production_package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Using Node 0.12 | |
shell: bash -l {0} | |
run: nvm install 0.12 | |
- name: Download production package | |
uses: actions/download-artifact@v4 | |
with: | |
name: bundle | |
- name: Untar the published package | |
run: | | |
tar -zxvf package.tgz | |
mv package/lib lib | |
- name: Test | |
run: node test/legacy/main.js | |
publish_package: | |
name: 'Publish package' | |
needs: | |
- production_package | |
- format | |
- test | |
- test_legacy | |
- test_package_quality | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Using Node v18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install latest npm version | |
run: npm install -g npm | |
- name: Download production package | |
uses: actions/download-artifact@v4 | |
with: | |
name: bundle | |
- name: Publish package | |
run: npm publish --provenance --access public package.tgz | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |