-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
description: "Release type" | ||
required: true | ||
default: "patch" | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
- prepatch | ||
- preminor | ||
- premajor | ||
- prerelease | ||
|
||
env: | ||
node_version: 18 | ||
|
||
concurrency: | ||
group: release | ||
cancel-in-progress: true | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js ${{ env.node_version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.node_version }} | ||
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set a npm token. REQUIRED | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Prepare modules | ||
run: npm ci | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Setup Git | ||
run: | | ||
git config --global user.email "sikrinick@gmail.com" | ||
git config --global user.name "${{ github.actor }}" | ||
- name: Increment package version and add tag | ||
run: npm version ${{ github.event.inputs.release-type }} | ||
|
||
- name: Release Tag | ||
id: release-tag-retriever | ||
run: echo "release-tag=$(git describe --tags)" >> $GITHUB_OUTPUT | ||
|
||
- name: Push commit and tag | ||
run: git push --follow-tags | ||
|
||
- name: Publish to NPM | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Print Release tag | ||
run: echo ${{ steps.release-tag-retreiver.outputs.release-tag }} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.github | ||
.idea | ||
*.iml |