From 9dd7d2873ce180ea7a25f6e37e1f59b32456046f Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Sat, 18 Apr 2020 21:47:07 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 5 ++--- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ .releaserc.js | 23 +++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 78527d8d..e8656233 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,8 @@ name: Deploy preview on: - push: - branches: - - master + release: + types: [published] jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..de345121 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release pipeline + +on: + push: + branches: + - master + +jobs: + publish: + if: "! contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: bahmutov/npm-install@v1 + - name: Check lint + run: yarn lint:strict + - name: Check unit test + run: yarn test:unit:ci + - name: Build + run: yarn build + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v2 + with: + extra_plugins: | + @semantic-release/changelog@3.0.6 + @semantic-release/git@7.0.18 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + # !TRICKY + # https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/td-p/38085 + always_job: + name: Always run job + runs-on: ubuntu-latest + steps: + - name: Always run + run: echo "TRICKY run" \ No newline at end of file diff --git a/.releaserc.js b/.releaserc.js new file mode 100644 index 00000000..7e316dc2 --- /dev/null +++ b/.releaserc.js @@ -0,0 +1,23 @@ +module.exports = { + branch: 'master', + plugins: [ + '@semantic-release/commit-analyzer', + '@semantic-release/release-notes-generator', + [ + '@semantic-release/changelog', + { + changelogFile: 'docs/CHANGELOG.md', + changelogTitle: + '# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.' + } + ], + ['@semantic-release/npm', { npmPublish: false }], + '@semantic-release/github', + [ + '@semantic-release/git', + { + assets: ['docs/CHANGELOG.md', 'package.json'] + } + ] + ] +}