From 5e423afee4a0873b68b2334e78c4ce74aa2d1880 Mon Sep 17 00:00:00 2001 From: Mikalai Silivonik Date: Tue, 26 Mar 2024 10:59:53 -0400 Subject: [PATCH] updated job for clarity also added one to publish to npm --- .github/workflows/{ci.yml => build.yml} | 4 +-- .github/workflows/npm.yml | 37 +++++++++++++++++++++++++ .github/workflows/pages.yml | 6 ++-- 3 files changed, 42 insertions(+), 5 deletions(-) rename .github/workflows/{ci.yml => build.yml} (96%) create mode 100644 .github/workflows/npm.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/build.yml similarity index 96% rename from .github/workflows/ci.yml rename to .github/workflows/build.yml index b502d84..8d03d46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: Build on: push: @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Use Node.js 20.x uses: actions/setup-node@v4 with: diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 0000000..e61bdb4 --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,37 @@ +name: Publish to npm + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + + - name: Install dependencies + uses: borales/actions-yarn@v5 + with: + cmd: install --immutable + + - name: Prepare + uses: borales/actions-yarn@v5 + with: + cmd: prepare + + - name: Pack + uses: borales/actions-yarn@v5 + with: + cmd: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4f3bba5..a96138d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,5 +1,5 @@ # Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages +name: Deploy docs to Pages on: # Runs on pushes targeting the default branch @@ -50,13 +50,13 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v4 - + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: # Upload entire repository path: './docs' - + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4