This repository was archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 161
Publish script #653
Merged
Merged
Publish script #653
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f8f80a1
adding validate github action to pull requests raised to the master b…
gligorkot c9d39c2
adding required runs-on os for matrix strategy
gligorkot 8065a75
removing the report coverage part as github action doesn't have acces…
gligorkot 9353ac5
adding a publish script to run on tag
gligorkot 506ca41
Merge remote-tracking branch 'upstream/master' into publish-script
gligorkot 30d0d73
fixed code review comment
gligorkot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,59 @@ | ||
# Version tags only | ||
|
||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
|
||
jobs: | ||
npmPublish: | ||
name: Publish to npm | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
# It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally) | ||
# Still then release author would be "github-actions". It's better if it's dedicated repo bot | ||
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Retrieve dependencies from cache | ||
id: cacheNpm | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.npm | ||
node_modules | ||
key: npm-v${{ env.NODE_VERSION }}-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }} | ||
|
||
- name: Install Node.js and npm | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Install dependencies | ||
if: steps.cacheNpm.outputs.cache-hit != 'true' | ||
run: | | ||
npm ci | ||
|
||
- name: Publish new version | ||
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work | ||
# as it appears actions/setup-node sets own value | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish | ||
|
||
- name: Create and publish a release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${GITHUB_REF##*/} | ||
prerelease: false | ||
generate_release_notes: true | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.