Skip to content

Commit 71159f8

Browse files
committed
Add GitHub Actions workflows for automated building and releases
1 parent a4771aa commit 71159f8

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Test and Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: '1.21'
22+
23+
- name: Run go fmt
24+
run: go fmt ./...
25+
26+
- name: Run go vet
27+
run: go vet ./...
28+
29+
- name: Run tests
30+
run: go test -v ./...
31+
32+
- name: Build
33+
run: go build -o build/flutterguard-cli
34+
35+
- name: Verify binary
36+
run: ./build/flutterguard-cli --version
37+
38+
- name: Upload build artifact
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: flutterguard-cli-linux
42+
path: build/flutterguard-cli

.github/workflows/release.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
name: Build FlutterGuard CLI
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
include:
16+
- os: ubuntu-latest
17+
goos: linux
18+
goarch: amd64
19+
filename: flutterguard-cli
20+
artifact_name: flutterguard-cli-linux-amd64
21+
- os: ubuntu-latest
22+
goos: linux
23+
goarch: arm64
24+
filename: flutterguard-cli
25+
artifact_name: flutterguard-cli-linux-arm64
26+
- os: macos-latest
27+
goos: darwin
28+
goarch: amd64
29+
filename: flutterguard-cli
30+
artifact_name: flutterguard-cli-darwin-amd64
31+
- os: macos-latest
32+
goos: darwin
33+
goarch: arm64
34+
filename: flutterguard-cli
35+
artifact_name: flutterguard-cli-darwin-arm64
36+
- os: windows-latest
37+
goos: windows
38+
goarch: amd64
39+
filename: flutterguard-cli.exe
40+
artifact_name: flutterguard-cli-windows-amd64.exe
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v4
48+
with:
49+
go-version: '1.21'
50+
51+
- name: Build on Linux/macOS
52+
if: matrix.os != 'windows-latest'
53+
run: |
54+
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/${{ matrix.artifact_name }}
55+
env:
56+
CGO_ENABLED: 0
57+
58+
- name: Build on Windows
59+
if: matrix.os == 'windows-latest'
60+
run: |
61+
go build -o build/${{ matrix.artifact_name }}
62+
env:
63+
GOOS: ${{ matrix.goos }}
64+
GOARCH: ${{ matrix.goarch }}
65+
CGO_ENABLED: 0
66+
67+
- name: Upload artifact
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: ${{ matrix.artifact_name }}
71+
path: build/${{ matrix.artifact_name }}
72+
73+
release:
74+
name: Create Release
75+
needs: build
76+
runs-on: ubuntu-latest
77+
permissions:
78+
contents: write
79+
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v4
83+
84+
- name: Download all artifacts
85+
uses: actions/download-artifact@v3
86+
with:
87+
path: build
88+
89+
- name: List artifacts
90+
run: ls -la build/
91+
92+
- name: Create Release
93+
uses: softprops/action-gh-release@v1
94+
with:
95+
files: |
96+
build/flutterguard-cli-linux-amd64/flutterguard-cli-linux-amd64
97+
build/flutterguard-cli-linux-arm64/flutterguard-cli-linux-arm64
98+
build/flutterguard-cli-darwin-amd64/flutterguard-cli-darwin-amd64
99+
build/flutterguard-cli-darwin-arm64/flutterguard-cli-darwin-arm64
100+
build/flutterguard-cli-windows-amd64.exe/flutterguard-cli-windows-amd64.exe
101+
draft: false
102+
prerelease: false
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RELEASE.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Release Process
2+
3+
This document explains how to create and release new versions of FlutterGuard CLI.
4+
5+
## Creating a Release
6+
7+
### 1. Update Version
8+
Update the version constant in `cmd/root.go`:
9+
10+
```go
11+
const Version = "1.1.0" // Update this
12+
```
13+
14+
### 2. Update CHANGELOG (Optional but recommended)
15+
Create or update CHANGELOG.md with new features, fixes, and improvements.
16+
17+
### 3. Commit Changes
18+
```bash
19+
git add cmd/root.go CHANGELOG.md
20+
git commit -m "Release v1.1.0"
21+
```
22+
23+
### 4. Create Git Tag
24+
```bash
25+
git tag -a v1.1.0 -m "Release FlutterGuard CLI v1.1.0"
26+
git push origin main
27+
git push origin v1.1.0
28+
```
29+
30+
### What Happens Next
31+
32+
When you push a tag starting with `v`, the GitHub Actions workflow automatically:
33+
34+
1. **Builds** the CLI for multiple platforms:
35+
- Linux (amd64, arm64)
36+
- macOS (amd64, Apple Silicon/arm64)
37+
- Windows (amd64)
38+
39+
2. **Creates a GitHub Release** with all built binaries attached
40+
41+
3. **Makes binaries downloadable** from the Releases page
42+
43+
## Supported Platforms
44+
45+
The build workflow creates binaries for:
46+
47+
| Platform | Architecture | Filename |
48+
|----------|--------------|----------|
49+
| Linux | x86_64 (amd64) | `flutterguard-cli-linux-amd64` |
50+
| Linux | ARM64 | `flutterguard-cli-linux-arm64` |
51+
| macOS | Intel (amd64) | `flutterguard-cli-darwin-amd64` |
52+
| macOS | Apple Silicon (arm64) | `flutterguard-cli-darwin-arm64` |
53+
| Windows | x86_64 (amd64) | `flutterguard-cli-windows-amd64.exe` |
54+
55+
## Troubleshooting
56+
57+
### Build Failed
58+
Check the GitHub Actions logs at: `https://github.com/flutterguard/flutterguard-cli/actions`
59+
60+
### Release Not Created
61+
- Verify the tag was pushed: `git push origin <tag-name>`
62+
- Check that tag starts with `v` (e.g., `v1.0.0`)
63+
- Review workflow logs for errors
64+
65+
## Continuous Integration
66+
67+
Every push to `main` or `develop` branches runs:
68+
- Code formatting checks (`go fmt`)
69+
- Static analysis (`go vet`)
70+
- Unit tests (`go test`)
71+
- Build verification
72+
73+
Failures in CI will prevent merges to main.

0 commit comments

Comments
 (0)