From 90f49004be5aa08a5c9d17cdccd03116437f9f93 Mon Sep 17 00:00:00 2001 From: Kagol Date: Tue, 7 Mar 2023 23:43:03 +0800 Subject: [PATCH] chore: add auto-publish workflow --- .github/release.yml | 25 ++++++++++++++++++ .github/workflows/auto-publish.yml | 42 ++++++++++++++++++++++++++++++ .husky/commit-msg | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/auto-publish.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..6d8816b --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,25 @@ +changelog: + exclude: + labels: + - ignore-for-release + authors: + - allcontributors[bot] + categories: + - title: Breaking Changes 🛠 + labels: + - Semver-Major + - breaking-change + - title: Exciting New Features 🎉 + labels: + - Semver-Minor + - feature + - enhancement + - title: Bug Fixes 🐛 + labels: + - Semver-Patch + - bug + - title: Other Changes + labels: + - documentation + - refactoring + - unit-test diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml new file mode 100644 index 0000000..e8db765 --- /dev/null +++ b/.github/workflows/auto-publish.yml @@ -0,0 +1,42 @@ +name: Auto publish + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: CheckOut Code + uses: actions/checkout@master + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: 'https://registry.npmjs.org' + + - name: Get package version + uses: tyankatsu0105/read-package-version-actions@v1 + id: package-version + + - name: Run Build Scripts + run: | + npm i --legacy-peer-deps + npm run build + npm run release + + - name: Publish + run: npm publish opentiny-vue-theme-${{ steps.package-version.outputs.version }}.tgz + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ steps.package-version.outputs.version }} + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} diff --git a/.husky/commit-msg b/.husky/commit-msg index d71a03b..7cd8dd9 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn commitlint --edit $1 +npx --no-install commitlint --edit