diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3d9fbd2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Release +on: + push: + branches: + - master +jobs: + release: + name: release + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: lts/* + - run: npm i -D semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/npm @semantic-release/github @semantic-release/git @semantic-release/exec @commitlint/cli @commitlint/config-conventional @google/semantic-release-replace-plugin + - run: npx semantic-release + env: + GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} + GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} + GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} + GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..744a89f --- /dev/null +++ b/.releaserc @@ -0,0 +1,79 @@ +{ + "branches": [ + {"name": "master"}, + {"name": "rc", "channel": "rc", "prerelease": "rc"}, + {"name": "beta", "channel": "beta", "prerelease": "beta"}, + {"name": "alpha", "channel": "alpha", "prerelease": "alpha"} + ], + "plugins": [ + ["@semantic-release/commit-analyzer", { + "preset": "angular", + "releaseRules": [ + {"breaking": "true", "release": "major"}, + {"type": "refactor", "release": "patch"}, + {"type": "perf", "release": "patch"} + ] + }], + ["@semantic-release/changelog", { + "changelogFile": "CHANGELOG.md", + "changelogTitle": "# Changelog" + }], + ["@semantic-release/release-notes-generator", { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + {"type": "feat", "section": "Features", "hidden": false}, + {"type": "fix", "section": "Fixes", "hidden": false}, + {"type": "docs", "section": "Documentations", "hidden": false}, + {"type": "refactor", "section": "Code Refactoring", "hidden": false}, + {"type": "style", "section": "Styles", "hidden": false}, + {"type": "chore", "section": "Maintenance", "hidden": false}, + {"type": "perf", "section": "Performance Improvements", "hidden": false}, + {"type": "ci", "section": "Continuous Integrations", "hidden": false} + ] + } + }], + "@semantic-release/github", + ["@semantic-release/exec", { + "generateNotesCmd": "echo ${nextRelease.version} > VERSION" + }], + [ + "@google/semantic-release-replace-plugin", + { + "replacements": [ + { + "files": ["package.xml"], + "from": ".*", + "to": "${nextRelease.version}", + "results": [ + { + "file": "package.xml", + "hasChanged": true, + "numMatches": 1, + "numReplacements": 1 + } + ], + "countMatches": true + }, + { + "files": ["setup.py"], + "from": "version='.*',", + "to": "version='${nextRelease.version}',", + "results": [ + { + "file": "setup.py", + "hasChanged": true, + "numMatches": 1, + "numReplacements": 1 + } + ], + "countMatches": true + } + ] + } + ], + ["@semantic-release/git", { + "assets": ["CHANGELOG.md", "VERSION", "package.xml", "setup.py"] + }] + ] +}