Skip to content

Commit

Permalink
refactor: ci jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ashgw committed Feb 23, 2025
1 parent 9b92a84 commit a3dedb4
Show file tree
Hide file tree
Showing 8 changed files with 5,567 additions and 4,574 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build

on:
pull_request:
workflow_dispatch:
workflow_call:

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Lint Knip (Production Only)

on:
pull_request:
workflow_dispatch:
workflow_call:

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Prettier

on:
pull_request:
workflow_dispatch:
workflow_call:

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Lint Spelling

on:
pull_request:
workflow_dispatch:
workflow_call:

Expand Down
55 changes: 12 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: CI

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:

permissions:
contents: write
Expand All @@ -26,8 +25,8 @@ jobs:
test:
uses: ./.github/workflows/test.yml

green-light:
if: always()
mergeable:
if: github.ref == 'refs/heads/main'
needs:
- lint
- dependencies
Expand All @@ -40,43 +39,13 @@ jobs:
id: all-green
with:
jobs: ${{ toJSON(needs)}}
docs:
runs-on: ubuntu-latest
needs:
- green-light
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm run build:docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./docs
keep_files: true
npm:
needs:
- green-light
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/prepare

- name: Build
run: pnpm run build
docs:
if: github.ref == 'refs/heads/main'
needs: [mergeable]
uses: ./.github/workflows/docs.yml

- name: Release
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
#!/bin/bash
if ! pnpm can-npm-publish; then
exit 0
fi
pnpm publish --no-git-checks --access public
npm:
if: github.ref == 'refs/heads/main'
needs: [mergeable]
uses: ./.github/workflows/npm.yml
20 changes: 20 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Docs

on:
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm run build:docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./docs
keep_files: true
30 changes: 30 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: NPM

on:
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/prepare

- name: Build
run: pnpm run build

- name: Release
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
#!/bin/bash
if ! pnpm can-npm-publish; then
exit 0
fi
pnpm publish --no-git-checks --access public
Loading

0 comments on commit a3dedb4

Please sign in to comment.