Merge pull request #9 from y-exp/main #11
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: Pipeline | |
on: | |
push: | |
branches: [main] | |
paths: ["package.json", "src/**", "tests/**"] | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize, reopened] | |
paths: ["package.json", "src/**", "tests/**"] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
name: Type Checking | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Run the type checker | |
run: pnpm check | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Run the linter | |
run: pnpm lint | |
build: | |
name: Building | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Build the package | |
run: pnpm build | |
test: | |
name: Testing | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Run tests | |
run: pnpm test | |
process: | |
name: Processing Changesets | |
needs: [test] | |
runs-on: ubuntu-latest | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Process changesets | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: pnpm run release:version | |
publish: pnpm run release:publish | |
title: "Pending Releases" | |
commit: "Update changelog and release" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PR_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: | | |
echo "published=${{ steps.changesets.outputs.published }}" >> $GITHUB_OUTPUT | |
deprecate: | |
name: Deprecating Beta Versions | |
needs: [process] | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.process.outputs.published == 'true' }} | |
steps: | |
- name: Deprecate beta versions | |
run: | | |
versions=$(npm view next-ws versions --json | jq -r '.[]') | |
beta_versions=$(echo "$versions" | grep '0.0.0-beta') | |
for version in $beta_versions; do | |
echo "Deprecating next-ws@$version" | |
npm deprecate next-ws@$version "This beta version has been merged into the latest release. Please upgrade to the latest version." | |
done | |
snapshot: | |
name: Releasing Snapshot | |
needs: [process] | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.process.outputs.published == 'false' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: ./.github/actions/node | |
- name: Publish snapshot version | |
run: | | |
pnpm run release:snapshot:version | |
pnpm run release:snapshot:publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
continue-on-error: true |