Skip to content

Commit f55a8bb

Browse files
chore(CI): add release automation (#25)
Introduce an automated release process. Use Google Release Please action for taking care of the release process. This will create release PRs for any new major, minor or fix releases. It will update major and minor (vX and vX.Y) tags aliases to the current tags. It will create and update the `CHANGELOG.md` file. Changes will be generated based on merged PR titles. More details: https://github.com/google-github-actions/release-please-action Requirements: * Enabled GitHub Action setting "Allow GitHub Actions to create and approve pull requests" --------- Co-authored-by: Ben Challis <[email protected]>
1 parent 359a6f3 commit f55a8bb

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

.github/workflows/release.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- .github/**
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
release-please:
16+
runs-on: ubuntu-22.04
17+
name: Release Automation
18+
steps:
19+
- uses: google-github-actions/release-please-action@v4
20+
id: release
21+
with:
22+
config-file: release-please-config.json
23+
manifest-file: .release-please-manifest.json
24+
include-component-in-tag: false
25+
26+
- uses: actions/checkout@v4
27+
if: ${{ steps.release.outputs.release_created }}
28+
- name: Tag Major and Minor versions
29+
if: ${{ steps.release.outputs.release_created }}
30+
run: |
31+
git config user.name github-actions[bot]
32+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
33+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/Lendable/sloth.git"
34+
git tag -d v${{ steps.release.outputs.major }} || true
35+
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
36+
git push origin :v${{ steps.release.outputs.major }} || true
37+
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
38+
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
39+
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
40+
git push origin v${{ steps.release.outputs.major }}
41+
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.2"
3+
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "sloth",
3+
"version": "0.1.2",
34
"private": true,
45
"exports": {
56
".": "./dist/index.js"

release-please-config.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"changelog-sections":
4+
[
5+
{ "type": "feat", "section": "Features" },
6+
{ "type": "fix", "section": "Bug Fixes" },
7+
{ "type": "perf", "section": "Performance Improvements" },
8+
{ "type": "revert", "section": "Reverts" },
9+
{ "type": "docs", "section": "Documentation", "hidden": true },
10+
{ "type": "style", "section": "Styles", "hidden": true },
11+
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
12+
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
13+
{ "type": "test", "section": "Tests", "hidden": true },
14+
{ "type": "build", "section": "Build System", "hidden": true },
15+
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
16+
],
17+
"plugins": [
18+
{
19+
"type": "sentence-case"
20+
}
21+
],
22+
"initial-version": "0.1.2",
23+
"include-v-in-tag": false,
24+
"include-component-in-tag": false,
25+
"release-type": "node",
26+
"pull-request-title-pattern": "chore: release ${version}",
27+
"pull-request-header": "I have created a release PR for this version",
28+
"packages": {
29+
".": {}
30+
}
31+
}

0 commit comments

Comments
 (0)