Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub actions (versions / ergonomics). #172

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 18 additions & 0 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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]
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20.x'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node version is bumped to 20.x in all these configuration files.

registry-url: 'https://registry.npmjs.org'
- run: npm ci
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general — I’ve updated things to use clean install so that we install from package-lock.json for consistency.

- run: npm publish
env:
# The secrets should be implicitly passed via “secrets: inherit”.
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]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the release type trigger to published as that appears to be the current recommendation.

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I’ve added a general change to pull out our workflows into reusable chunks. The GitHub UI sort of rewards you with a better UX for doing this (e.g., better graphical representation of what’s happening).

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:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped all these as part of the node 16 >> 20 upgrades in GH actions.

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
Loading