Skip to content

upgrade everything (#51) #330

upgrade everything (#51)

upgrade everything (#51) #330

Workflow file for this run

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!"