-
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
1 parent
7e48cac
commit d75dd7a
Showing
2 changed files
with
86 additions
and
46 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,86 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- package.json | ||
|
||
concurrency: | ||
group: main | ||
|
||
jobs: | ||
|
||
check-conditions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
isNewVersion: ${{ steps.check-tag.outputs.exists == 'false' }} | ||
npmTokenAvailable: ${{ steps.npm.outputs.available }} | ||
steps: | ||
|
||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get the package version tag | ||
id: package-version | ||
run: echo "tag=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT | ||
|
||
- name: Check if tag exists | ||
uses: mukunku/[email protected] | ||
id: check-tag | ||
with: | ||
tag: ${{ steps.package-version.outputs.tag }} | ||
|
||
- name: Check if NPM token secret is available | ||
id: npm | ||
run: echo "available=${{ secrets.NPM_TOKEN != '' }}" >> $GITHUB_OUTPUT | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
needs: build | ||
steps: | ||
|
||
- name: Create a new version tag | ||
uses: Klemensas/action-autotag@stable | ||
id: tag | ||
with: | ||
tag_prefix: v | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create the changelog | ||
uses: heinrichreimer/[email protected] | ||
id: changelog | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract the release notes | ||
uses: actions-ecosystem/action-regex-match@v2 | ||
id: releasenotes | ||
with: | ||
text: ${{ steps.changelog.outputs.changelog }} | ||
regex: ^(\n|.)*?(##(.+)\n\n((\n|.)*?))(\n)+(##(\n|.)*)?(\n)+\\\*(.+)$ | ||
|
||
- name: Create a new GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag.outputs.tagname }} | ||
body: ${{ steps.releasenotes.outputs.group4 }} | ||
artifacts: release-artifacts/* | ||
|
||
deploy-npm: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
needs: | ||
- release | ||
- check-conditions | ||
if: needs.check-conditions.outputs.npmTokenAvailable == 'true' | ||
steps: | ||
|
||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Publish to NPM | ||
uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
access: public | ||
token: ${{ secrets.NPM_TOKEN }} |
This file was deleted.
Oops, something went wrong.