diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml new file mode 100644 index 0000000..f390abc --- /dev/null +++ b/.github/workflows/semantic-release.yml @@ -0,0 +1,34 @@ +name: Semantic Release + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.run-release.outputs.VERSION }} + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + cache: npm + node-version: 20 + + - name: Install and Run + id: run-release + env: + DEBUG: semantic-release:github + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + npm install --global semantic-release @semantic-release/github @semantic-release/changelog @semantic-release/git @semantic-release/exec + npx semantic-release + + - name: Output version + run: echo ${{ steps.run-release.outputs.VERSION }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..d5ab13d --- /dev/null +++ b/.releaserc @@ -0,0 +1,19 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "semantic-release-github", + ["@semantic-release/npm", { + "npmPublish": false + }], + ["@semantic-release/git", { + "assets": ["package.json", "CHANGELOG.md"], + "message": "Bump version: ${nextRelease.version} \n\n${nextRelease.notes}" + }], + ["@semantic-release/exec", { + "prepareCmd": "echo '::set-output name=VERSION::${nextRelease.version}'" + }] + ] +} \ No newline at end of file