From 65cf7a9e2fb3acd217c2e964cdc50b80d6be80c3 Mon Sep 17 00:00:00 2001 From: James Prevett Date: Wed, 30 Oct 2024 16:10:10 -0500 Subject: [PATCH] Refactor CI --- .github/workflows/deploy-docs.yaml | 39 ++++++++++++++++ .github/workflows/release-common.yaml | 31 +++++++++++++ .github/workflows/release.yaml | 66 +++------------------------ 3 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/deploy-docs.yaml create mode 100644 .github/workflows/release-common.yaml diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml new file mode 100644 index 00000000..41a528f8 --- /dev/null +++ b/.github/workflows/deploy-docs.yaml @@ -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 diff --git a/.github/workflows/release-common.yaml b/.github/workflows/release-common.yaml new file mode 100644 index 00000000..e711f584 --- /dev/null +++ b/.github/workflows/release-common.yaml @@ -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}} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5e7c63b9..07533cdd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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