generated from unplugin/unplugin-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update github action workflows
- Loading branch information
1 parent
baa8e6f
commit 4a4f2e9
Showing
2 changed files
with
68 additions
and
29 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
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,22 +1,68 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
branches: | ||
- main | ||
name: Release | ||
jobs: | ||
release: | ||
release-pr: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
token: ${{ secrets.RELEASE_PR_TOKEN }} | ||
changelog-types: |- | ||
[ | ||
{ "type": "feat", "section": "🔖 Features", "hidden": false }, | ||
{ "type": "fix", "section": "🐛 Bug Fixes", "hidden": false }, | ||
{ "type": "chore", "section": "🧹 Miscellaneous", "hidden": false } | ||
] | ||
# Format changelog, workaround for https://github.com/google-github-actions/release-please-action/issues/542 | ||
# Taken from https://github.com/remarkablemark/release-please-extra-files-demo/blob/master/.github/workflows/release-please.yml | ||
- uses: actions/checkout@v3 | ||
if: ${{ steps.release.outputs.pr }} | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }} | ||
|
||
- name: Configure Git user | ||
if: ${{ steps.release.outputs.pr }} | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git --no-pager show --name-only | ||
- name: Format CHANGELOG.md | ||
if: ${{ steps.release.outputs.pr }} | ||
run: npx prettier --write CHANGELOG.md | ||
|
||
- name: Commit and push | ||
if: ${{ steps.release.outputs.pr }} | ||
run: | | ||
git add CHANGELOG.md | ||
git commit -m 'chore: Format CHANGELOG.md with Prettier' --no-verify | ||
git push | ||
publish_npm: | ||
name: Publish to npm | ||
runs-on: ubuntu-latest | ||
needs: [release-pr] | ||
if: needs.release-pr.outputs.release_created | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- run: npx changelogithub | ||
node-version: 16 | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Config npm | ||
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Publish to npm | ||
run: pnpm publish --access public --no-git-checks |