-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify workflow for deploying package
- Loading branch information
1 parent
c605d4d
commit 86857cb
Showing
3 changed files
with
61 additions
and
92 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
name: Publish package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.check.outputs.version }} | ||
steps: | ||
- name: Check version change | ||
id: check | ||
uses: marshallku/actions/version/check-npm@master | ||
create-tag-release: | ||
runs-on: ubuntu-latest | ||
needs: ["check-version"] | ||
if: ${{ needs.check-version.outputs.version != '' }} | ||
outputs: | ||
tag-exists: ${{ steps.create-tag.outputs.tag_exists }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Generate body | ||
id: generate-body | ||
run: | | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
git_logs=$(git log "$(git describe --tags --abbrev=0)"..HEAD --oneline) | ||
git_logs="${git_logs//$'\n'/$'\n'- }" | ||
{ | ||
echo "body<<$EOF" | ||
echo "- $git_logs" | ||
echo "$EOF" | ||
} >>"$GITHUB_OUTPUT" | ||
shell: bash | ||
- uses: rickstaa/action-create-tag@v1 | ||
id: create-tag | ||
with: | ||
tag: ${{ needs.check-version.outputs.version }} | ||
tag_exists_error: true | ||
message: ${{ needs.check-version.outputs.version }} | ||
- name: Create a GitHub release | ||
if: ${{ steps.create-tag.outputs.tag_exists == 'false' }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ needs.check-version.outputs.version }} | ||
name: ${{ needs.check-version.outputs.version }} | ||
body: ${{ steps.generate-body.outputs.body }} | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: ["check-version", "create-tag-release"] | ||
if: ${{ needs.check-version.outputs.version != '' && needs.create-tag-release.outputs.tag-exists == 'false' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: marshallku/actions/setup/pnpm@master | ||
- run: pnpm publish --access=public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |