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

Automatically publish npm pack to GH Releases #29

Merged
merged 7 commits into from
Oct 29, 2024
Merged
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
35 changes: 30 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ on:
push:
branches:
- main

pull_request:
release:
types: [created]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand All @@ -18,9 +23,29 @@ jobs:

- run: npm ci
- run: npm run build

- name: Verify that `npm run build` did not change outputs
run: git diff --exit-code

- run: npm test
- run: npm run lint

package:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build

permissions:
contents: write

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to pin this to an .nvmrc file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess, but it doesn't solve much IMO. It then requires installing nvm, calling nvm use, etc.

cache: npm

- run: npm ci
- run: npm pack

- name: Upload package to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} ./*.tgz