You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert make release to Go script with improved UI (#18)
- Convert release target from shell script to Go script
(scripts/make-release.go)
- Add colored terminal output with emojis for better UX
- Improve error handling and validation
- Use proper version parsing library for tag management
- Update README to reflect PR-based workflow as default
- Simplify Makefile release target to call Go script
- Maintain all existing functionality including default branch updates
Copy file name to clipboardExpand all lines: README.md
+79-42Lines changed: 79 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,36 +40,25 @@ https://www.linkedin.com/in/zph/ that appropriate safeguards are being taken.
40
40
41
41
## Release Process
42
42
43
-
The release process is automated through the `make release` command, which handles tag management, version file updates, GitHub releases, and pushing changes.
43
+
The release process uses a PR-based workflow through the `make release` command. This creates a release branch, tags the release, and pushes both to GitHub. GitHub Actions then automatically builds and creates the release when the tag is pushed.
44
44
45
45
### Prerequisites
46
46
47
47
Before running the release process, ensure you have the following set up:
48
48
49
-
1.**GPG Key for Signing**: A GPG key must be configured for signing release artifacts.
50
-
- Set the `GPG_FINGERPRINT` environment variable to your GPG key fingerprint:
51
-
```bash
52
-
export GPG_FINGERPRINT="your-gpg-key-fingerprint"
53
-
```
54
-
- To find your GPG key fingerprint:
55
-
```bash
56
-
gpg --list-secret-keys --keyid-format LONG
57
-
```
58
-
- The fingerprint is the long string after the key type (e.g., `RSA 4096/ABC123DEF456...`)
59
-
60
-
2. **GitHub Authentication**: You need authentication configured for pushing to GitHub.
49
+
1.**GitHub Authentication**: You need authentication configured for pushing to GitHub.
61
50
- Either configure SSH keys for git push, or
62
51
- Set up a GitHub Personal Access Token with appropriate permissions
63
-
- goreleaser will use `GITHUB_TOKEN` environment variable if set, otherwise it will use git credentials
64
52
65
-
3. **Required Tools**:
66
-
- `goreleaser` - Install from https://goreleaser.com/install/
53
+
2.**Required Tools**:
67
54
-`git` - For version control operations
68
55
-`make` - For running the release command
69
56
70
-
### Release Workflow
57
+
**Note**: GPG signing and release building are handled automatically by GitHub Actions CI/CD. You don't need to configure GPG keys or goreleaser locally for the PR-based workflow.
71
58
72
-
The `make release`command performs the following steps:
59
+
### Release Workflow (PR-Based)
60
+
61
+
The `make release` command implements a PR-based workflow:
73
62
74
63
1.**Version Check**: Reads the current version from the `VERSION` file and checks if a tag for that version already exists.
75
64
@@ -80,38 +69,47 @@ The `make release` command performs the following steps:
80
69
81
70
3.**Version File Update**: If a new version was determined, the `VERSION` file is automatically updated with the new version number.
82
71
83
-
4. **Confirmation Prompts**: The process includes interactive confirmations at key steps:
84
-
- Confirmation to create and tag the release
85
-
- Confirmation to deploy as a GitHub release
86
-
- Confirmation to push tags and commits to GitHub
72
+
4.**Default Branch Update**: Fetches and updates the default branch (`r3.0.62`) to ensure the release branch is created from the latest code.
73
+
74
+
5.**Release Branch Creation**: Creates a new branch named `release/v{VERSION}` (e.g., `release/v3.0.62007`) from the updated default branch.
75
+
76
+
6.**Version File Commit**: If the `VERSION` file was modified, it commits the change on the release branch with message "Update VERSION to {version}".
77
+
78
+
7.**Tag Creation**: Creates an annotated git tag with the version number on the release branch.
87
79
88
-
5. **Tag Creation**: Creates an annotated git tag with the version number.
80
+
8.**Push to GitHub**: Pushes both the release branch and tag to GitHub.
89
81
90
-
6. **Version File Commit**: If the `VERSION` file was modified, it commits the change with message "Update VERSION to {version}".
82
+
9.**GitHub Actions**: When the tag is pushed, GitHub Actions automatically:
83
+
- Builds binaries for all supported platforms (Linux, macOS, Windows, FreeBSD)
84
+
- Creates archives (zip files) for each platform/architecture combination
85
+
- Generates SHA256 checksums
86
+
- Signs the checksum file with GPG (configured in CI/CD)
87
+
- Creates a GitHub release
91
88
92
-
7. **GitHub Release**: Uses `goreleaser` to:
93
-
- Build binaries for all supported platforms (Linux, macOS, Windows, FreeBSD)
94
-
- Create archives (zip files) for each platform/architecture combination
95
-
- Generate SHA256 checksums
96
-
- Sign the checksum file with your GPG key
97
-
- Create a draft GitHub release (you can publish it manually after review)
89
+
10.**Pull Request**: Create a pull request from the release branch (`release/v{VERSION}`) to the default branch (`r3.0.62`).
98
90
99
-
8. **Push to GitHub**: Pushes the tag and commits to the remote repository.
91
+
11.**Merge**: After CI completes successfully, merge the PR to complete the release.
100
92
101
93
### Usage
102
94
103
-
To create a release, simply run:
95
+
To create a release using the PR-based workflow:
104
96
105
97
```bash
106
98
make release
107
99
```
108
100
109
101
The process will guide you through each step with clear prompts. You can cancel at any point if needed.
110
102
103
+
**Note**: The command automatically updates the default branch (`r3.0.62`) before creating the release branch, so you can run it from any branch. The release branch will always be created from the latest version of the default branch.
104
+
111
105
### Example Release Session
112
106
113
107
```bash
114
108
$ make release
109
+
Updating default branch (r3.0.62) before creating release branch...
110
+
Fetching latest changes from origin...
111
+
Checking out default branch r3.0.62...
112
+
Default branch updated successfully.
115
113
Checking if tag v3.0.62006 already exists...
116
114
Tag v3.0.62006 already exists!
117
115
Current version from VERSION file: 3.0.62006
@@ -127,30 +125,69 @@ VERSION file updated.
127
125
Release Summary:
128
126
Tag: v3.0.62007
129
127
Version: 3.0.62007
128
+
Release Branch: release/v3.0.62007
129
+
Target Branch: r3.0.62
130
130
=========================================
131
131
132
-
Do you want to create tag v3.0.62007? (yes/no): yes
132
+
Do you want to create release branch and tag v3.0.62007? (yes/no): yes
133
+
134
+
Creating release branch release/v3.0.62007 from updated default branch (r3.0.62)...
135
+
Release branch created from updated r3.0.62.
133
136
134
-
Creating tag v3.0.62007...
137
+
Committing VERSION file change...
135
138
VERSION file change committed.
139
+
140
+
Creating annotated tag v3.0.62007...
136
141
Tag v3.0.62007 created successfully.
137
142
138
-
Do you want to deploy this as a GitHub release? (yes/no): yes
143
+
Pushing branch and tag to origin...
144
+
Branch and tag pushed successfully.
145
+
146
+
=========================================
147
+
Release PR Created Successfully!
148
+
=========================================
149
+
150
+
Next steps:
151
+
1. GitHub Actions will automatically build the release when the tag is pushed.
- Creating releases without CI/CD (not recommended for production)
182
+
183
+
**For production releases, always use `make release` (PR-based workflow).**
184
+
149
185
### Troubleshooting
150
186
151
-
- **GPG signing fails**: Ensure `GPG_FINGERPRINT` is set correctly and your GPG key is available in your keyring
152
187
- **GitHub push fails**: Check your git credentials or SSH keys are configured correctly
153
-
- **goreleaser fails**: Ensure you have the latest version of goreleaser installed and check the `.goreleaser.yml` configuration
188
+
- **Branch already exists**: If the release branch already exists, delete it first or use a different version
189
+
- **CI/CD build fails**: Check GitHub Actions logs for build errors. The release will be created automatically when the tag is pushed successfully
190
+
- **PR merge conflicts**: Resolve conflicts in the PR before merging. The tag and release are already created, so merging just updates the default branch
0 commit comments