Skip to content

Commit 76ef75d

Browse files
authored
Merge pull request #38 from btnguyen2k/release
Merge to main after releasing new version 0.1.1
2 parents 3e13928 + 575b971 commit 76ef75d

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

.github/workflows/release.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
env:
1010
BRANCH_TO_RELEASE: 'release'
1111
TAG_PREFIX: 'v'
12+
FILE_CHANGELOG: 'RELEASE-NOTES.md'
13+
FILE_MODULE: 'module.go'
1214

1315
jobs:
1416
CallCI:
@@ -69,8 +71,6 @@ jobs:
6971
7072
if [ "${RESULT}" == "SUCCESS" ]; then
7173
DATE=`date +%Y-%m-%d`
72-
FILE_CHANGELOG="RELEASE-NOTES.md"
73-
FILE_MODULE="module.go"
7474
head -1 ${FILE_CHANGELOG} > .temp.md
7575
echo -e "\n## ${DATE} - v${VERSION}\n\n${RELEASE_NOTES}" >> .temp.md
7676
tail -n +2 ${FILE_CHANGELOG} >> .temp.md
@@ -98,6 +98,28 @@ jobs:
9898
else
9999
echo "❎ SKIPPED."
100100
fi
101+
- name: Create release
102+
uses: actions/github-script@v7
103+
env:
104+
RESULT: ${{ needs.ReleaseDryRun.outputs.RESULT }}
105+
VERSION: ${{ needs.ReleaseDryRun.outputs.VERSION }}
106+
RELEASE_NOTES: ${{ needs.ReleaseDryRun.outputs.RELEASE_NOTES }}
107+
with:
108+
script: |
109+
if (process.env['RESULT'] != 'SUCCESS') {
110+
console.log('❎ SKIPPED.');
111+
return;
112+
}
113+
const {data: release} = await github.rest.repos.createRelease({
114+
owner: context.repo.owner,
115+
repo: context.repo.repo,
116+
tag_name: process.env['TAG_PREFIX'] + process.env['VERSION'],
117+
name: process.env['TAG_PREFIX'] + process.env['VERSION'],
118+
body: process.env['RELEASE_NOTES'],
119+
draft: false,
120+
prerelease: false,
121+
});
122+
console.log('✅ Created release: ', release);
101123
102124
MergeToMain:
103125
runs-on: ubuntu-latest

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ Template to quickly spin up a Go module project.
2323
- (Less preferred method) Or simply clone/fork this repository.
2424
2. Update `go.mod` and `module.go` file to reflect your module name and required Go version.
2525
3. Review other source code and test files, either update them to reflect your module's name and functionality or remove them.
26-
4. `LICENSE.tpl.md`, `README.tpl.md` and `RELEASE-NOTES.tpl.md` files are templates. Update them to reflect your module's name and functionality. Then rename them to `LICENSE.md`, `README.md` and `RELEASE-NOTES.md`.
26+
4. `LICENSE.tpl.md`, `README.tpl.md` and `RELEASE-NOTES.tpl.md` files are templates; update them to reflect your module's name and functionality; then rename them to `LICENSE.md`, `README.md` and `RELEASE-NOTES.md`.
2727
5. Update other files to suit your needs.
2828
6. Happy coding!
2929

3030
**Workflows**
3131

3232
Workflows implemented by this template are as the following:
3333

34-
- Dependencies are checked and updated weekly by `dependabot.yaml`, and then PRs are automatically merged to `main` branch by `automerge-dependabot.yaml`.
34+
- `dependabot.yaml` configures dependencies are checked and updated weekly. `dependabot` will create a PR for each dependency update. `automerge-dependabot.yaml` is triggered to automatically merged PRs to `main` branch.
3535
- `ci.yaml` is triggered on every push to any branch to run tests and generate code coverage report.
3636
- Once PR is approved and merged to `release` branch, `release.yaml` is triggered to create a new release. Then a new PR is created to merge `release` branch to `main` branch.
3737

3838
A suggested git workflow to use with this template is as the following:
3939

4040
- Work on your code in development/feature branches as usual.
4141
- Once ready, create a PR to merge your development/feature branch to `release` branch.
42-
- Workflow `release.yaml` will be triggered to create a new release.
43-
- Then a new PR will be created to merge `release` branch to `main` branch. Note: you have to review and approve the PR by yourself to finalize the merge.
42+
- Once the PR is merged, `release.yaml` is triggered to create a new release.
43+
- Then a new PR is created to merge `release` branch to `main` branch. Note: you have to review and approve the PR by yourself to finalize the merge.
4444

4545
> Remember to enable the setting "Allow GitHub Actions to create and approve pull requests" from project's `Settings -> Actions -> General`.
4646

RELEASE-NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# go-module-template release notes
22

3+
## 2023-11-26 - v0.1.1
4+
5+
### Fixed/Improvement
6+
7+
- Fix action release to actually create a release package
8+
39
## 2023-11-26 - v0.1.0
410

511
Template for Go module projects:

module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package mymodule
33

44
const (
55
// Version holds the semantic version number of this module.
6-
Version = "0.1.0"
6+
Version = "0.1.1"
77
)
88

99
// This file contains module's metadata only, which is package level documentation and module Version string.

0 commit comments

Comments
 (0)