Skip to content

Commit

Permalink
Update GitHub actions (versions / ergonomics).
Browse files Browse the repository at this point in the history
This change set bumps the referenced / reusable GitHub actions to their
latest versions, bumps node versions, and enables reuse of a “test” wf.
  • Loading branch information
theengineear committed Feb 29, 2024
1 parent 1ebdedc commit b44d9cc
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/check-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run tests on pushes to all branches.
name: Check Branch
on: [push]
jobs:
test:
uses: ./.github/workflows/test.yaml
23 changes: 23 additions & 0 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Publish package to npm whenever a release is pushed.
# See https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish to npm
on:
workflow_call:
inputs:
secrets:
NPM_TOKEN:
description: 'A token to enable this workflow to publish to npm.'
required: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Run tests and publish to all registries if successful.
name: Publish
on:
release:
types: [published]
jobs:
test:
uses: ./.github/workflows/test.yaml
publish-to-npm:
needs: test
uses: ./.github/workflows/publish-to-npm.yaml
secrets: inherit
23 changes: 0 additions & 23 deletions .github/workflows/release.yml

This file was deleted.

17 changes: 8 additions & 9 deletions .github/workflows/push.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Push
on: [push]
# Test flow triggered by other workflows.
name: Test
on: [workflow_call]
jobs:
test:
main:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm ci
- run: npm run lint
- run: npm start &
- run: sleep 2
Expand Down

0 comments on commit b44d9cc

Please sign in to comment.