Update version number in package.json #282
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: Pull Request Workflow | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: ["main"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: ๐ Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
node-version: [20.x, 21.x] | |
pnpm-version: [8.x] | |
timeout-minutes: 5 | |
steps: | |
- name: ๐ Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: โ๏ธ Setup | |
uses: ./.github/setup | |
timeout-minutes: 1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
pnpm-version: ${{ matrix.pnpm-version }} | |
env: ${{ secrets.CI_ENV_FILE }} | |
- name: ๐ฎ Type checking | |
timeout-minutes: 1 | |
run: | | |
echo "::remove-matcher owner=tsc::" | |
STEP_NAME="๐ฎ Type checking" | |
node --import tsx script/src/stdout/tsc.ts pnpm tsc --cache-dir=.turbo | |
- name: ๐ Spell checking | |
timeout-minutes: 1 | |
run: | | |
STEP_NAME="๐ Spell checking" | |
node --import tsx script/src/stdout/spell.ts pnpm spell --cache-dir=.turbo | |
- name: ๐จ Formatting | |
timeout-minutes: 1 | |
run: | | |
STEP_NAME="๐จ Formatting" | |
node --import tsx script/src/stdout/format.ts pnpm format --cache-dir=.turbo | |
- name: ๐ซ Linting | |
timeout-minutes: 1 | |
run: | | |
echo "::remove-matcher owner=eslint-compact::" | |
echo "::remove-matcher owner=eslint-stylish::" | |
STEP_NAME="๐ซ Linting" | |
node --import tsx script/src/stdout/lint.ts pnpm lint --cache-dir=.turbo | |
- name: ๐ป Dead code elimination | |
timeout-minutes: 1 | |
run: | | |
STEP_NAME="๐ป Dead code elimination" | |
node --import tsx script/src/stdout/knip.ts pnpm knip | |
- name: ๐ฆ Unit testing | |
timeout-minutes: 2 | |
run: | | |
STEP_NAME="๐ฆ Unit testing" | |
node --import tsx script/src/stdout/test.ts pnpm test:ci | |
- name: ๐ท๏ธ Versioning | |
if: github.ref != 'refs/heads/main' | |
timeout-minutes: 1 | |
run: | | |
echo "Checking version..." | |
git fetch origin main:main --force --depth=1 | |
git show main:package.json > .main-package.json | |
node --import tsx script/src/versioning.ts "๐ท๏ธ Versioning" .main-package.json package.json | |
rm .main-package.json | |
- name: ๐๏ธ Building | |
if: github.ref != 'refs/heads/main' | |
timeout-minutes: 1 | |
run: pnpm build | |
release: | |
name: ๐ฆ Release | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.test.result == 'success' | |
timeout-minutes: 3 | |
steps: | |
- name: ๐ Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: โ๏ธ Setup | |
uses: ./.github/setup | |
timeout-minutes: 1 | |
with: | |
node-version: 20.x | |
pnpm-version: 8.x | |
env: ${{ secrets.CI_ENV_FILE }} | |
- name: ๐๏ธ Building | |
id: build | |
timeout-minutes: 1 | |
run: pnpm build | |
- name: ๐ฆ Releasing | |
if: steps.build.outcome == 'success' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
timeout-minutes: 2 | |
run: | | |
echo "Creating a release..." | |
version=`node -pe "require('./package.json').version"` | |
echo "Version: v$version" | |
gh release delete "v$version" --yes && echo "Deleting existing release..." || true | |
tar -cJf bundle.tar.xz ./dist ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml .nvmrc .env.example | |
gh release create "v$version" bundle.tar.xz --generate-notes | |
echo "Release created!" |