Skip to content

Commit

Permalink
Refactor CI
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Oct 30, 2024
1 parent f4d1bd7 commit 65cf7a9
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 60 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy Docs
on:
workflow_dispatch:
workflow_call:

jobs:
docs:
runs-on: ubuntu-latest
name: Docs build and deploy
permissions:
contents: write
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Build docs
run: npm run build:docs

- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs

- name: 'Deploy docs'
id: deploy
uses: actions/deploy-pages@v4
31 changes: 31 additions & 0 deletions .github/workflows/release-common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
workflow_call:
secrets:
npm_token:
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup npm authentication
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Publish
run: npm publish --access=public --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
66 changes: 6 additions & 60 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,15 @@ name: Release
on:
release:
types: [created]
workflow_call:
secrets:
npm_token:
required: true
jobs:
ci:
name: CI Checks
uses: ./.github/workflows/ci.yaml
docs:
name: Docs
uses: ./.github/workflows/deploy-docs.yaml
release:
runs-on: ubuntu-latest
name: Release
uses: ./github/workflows/release-common.yaml
needs: ci
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup npm authentication
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Publish
run: npm publish --access=public --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
docs:
runs-on: ubuntu-latest
name: Docs build and deploy
permissions:
contents: write
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Build docs
run: npm run build:docs

- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs

- name: 'Deploy docs'
id: deploy
uses: actions/deploy-pages@v4
secrets: inherit

0 comments on commit 65cf7a9

Please sign in to comment.