-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrades dependencies and actions
- Upgrades the package dependencies - Switches back to ^ for the version prefix. The ~ was in response to knex not following sever, but that's an edgecase and I think ^ is the better prefix most of the time - Replaces nyc with c8 - Adds a new publish action that will publish NPM packages each time a Release is created - Removes the pre-push reminder to update the package version. That is performed in the publish action now. - Updates the pull request verification job to use updated package scripts
- Loading branch information
Showing
8 changed files
with
914 additions
and
1,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This workflow will publish the npm package when a release is created | ||
|
||
name: NPM publish | ||
|
||
on: | ||
release: | ||
# This specifies that the build will be triggered when we publish a release | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
|
||
# Run on latest version of ubuntu | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# "ref" specifies the branch to check out. | ||
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted | ||
ref: ${{ github.event.release.target_commitish }} | ||
# install Node.js | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
# Specifies the registry, this field is required for publishing below! | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: ENVVARS | ||
env: | ||
EVENT_CONTEXT: ${{ toJson(github.event) }} | ||
run: | | ||
git config --global user.name "losandes cicd" | ||
git config --global user.email "andes.collab+ghcicd@gmail.com" | ||
echo "node: $(node --version)" | ||
echo "npm: $(npm --version)" | ||
# echo "EVENT_CONTEXT:" | ||
# echo "$EVENT_CONTEXT" | ||
|
||
- name: Install packages | ||
run: | | ||
npm i -g pnpm | ||
pnpm install | ||
- name: Run tests | ||
env: | ||
CI: true | ||
run: pnpm run test:ci | ||
|
||
# upgrade npm version in package.json to the tag used in the release. | ||
- name: Set package version | ||
run: npm version ${{ github.event.release.tag_name }} | ||
|
||
# publish the package to NPM and set the tag name to the branch name that | ||
# the release is targeting (i.e. latest, latest-v1, etc.) | ||
# Note that npm publish commits a tag to git | ||
# alsosee: https://michaelzanggl.com/articles/github-actions-cd-setup/ | ||
- name: Publish to NPM | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish --tag ${{ github.event.release.target_commitish }} | ||
|
||
- name: Push version change to latest | ||
env: | ||
# The secret is passed automatically. Nothing to configure. | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run: git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.