Skip to content

Commit

Permalink
use standardised publish step (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus authored Oct 20, 2023
1 parent 995ad13 commit 9339c3b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 66 deletions.
112 changes: 46 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,87 +11,67 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run lint step
run: npm run lint
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run lint step
run: npm run lint

test-node:
name: Test on Node.js
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.x # to be removed 2023-09-11
- 18.x # to be removed 2025-04-30
- 20.x # to be removed 2026-04-30
- 18.x # to be removed 2025-04-30
- 20.x # to be removed 2026-04-30
- 21.x # to be removed 2024-06-01
steps:
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:node
- name: Checkout the project
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:node

test-linux-browsers:
name: Test on Linux Firefox & Chrome
runs-on: ubuntu-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1

test-windows-browsers:
name: Test on Windows Firefox, Chrome & Edge
runs-on: windows-latest
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser

release:
name: Publish a Release
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [lint, test-node, test-linux-browsers]
steps:
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Semantic Release
run: npx semantic-release
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.github_token}}
- name: Checkout the project
uses: actions/checkout@v2
- name: Use Node.js 18
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install dependencies
run: npm i
- name: Run Node.js Tests
run: npm run test:browser
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: npm
- run: npm ci
- run: npm test
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm whoami; npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 comments on commit 9339c3b

Please sign in to comment.