Skip to content

Commit 7cd5516

Browse files
committed
feat: Add GoReleaser and GitHub Actions for distribution
- Add .goreleaser.yaml for cross-platform builds - Add .github/workflows/release.yml for automated releases - Add .github/workflows/ci.yml for build/test on push - Add MIT LICENSE file - Supports darwin/linux on amd64/arm64 - Homebrew tap auto-update on release
1 parent 8e0b55f commit 7cd5516

4 files changed

Lines changed: 170 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev-mvp]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.21'
19+
20+
- name: Build
21+
run: go build -v ./...
22+
23+
- name: Test
24+
run: go test -v ./...
25+
26+
lint:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: '1.21'
35+
36+
- name: golangci-lint
37+
uses: golangci/golangci-lint-action@v3
38+
with:
39+
version: latest

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.21'
24+
25+
- name: Run tests
26+
run: go test ./...
27+
28+
- name: Run GoReleaser
29+
uses: goreleaser/goreleaser-action@v5
30+
with:
31+
distribution: goreleaser
32+
version: latest
33+
args: release --clean
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
project_name: dev-cleaner
3+
4+
before:
5+
hooks:
6+
- go mod tidy
7+
- go test ./...
8+
9+
builds:
10+
- id: dev-cleaner
11+
main: ./main.go
12+
binary: dev-cleaner
13+
env:
14+
- CGO_ENABLED=0
15+
goos:
16+
- darwin
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm64
21+
ldflags:
22+
- -s -w
23+
- -X github.com/thanhdevapp/dev-cleaner/cmd/root.Version={{.Version}}
24+
25+
archives:
26+
- id: default
27+
format: tar.gz
28+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
29+
files:
30+
- README.md
31+
- LICENSE*
32+
33+
checksum:
34+
name_template: 'checksums.txt'
35+
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- '^docs:'
41+
- '^test:'
42+
- '^chore:'
43+
- Merge pull request
44+
- Merge branch
45+
46+
brews:
47+
- name: dev-cleaner
48+
repository:
49+
owner: thanhdevapp
50+
name: homebrew-tools
51+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
52+
commit_author:
53+
name: goreleaserbot
54+
email: bot@goreleaser.com
55+
homepage: "https://github.com/thanhdevapp/dev-cleaner"
56+
description: "Clean development artifacts on macOS - Xcode, Gradle, node_modules"
57+
license: "MIT"
58+
install: |
59+
bin.install "dev-cleaner"
60+
test: |
61+
system "#{bin}/dev-cleaner", "--version"
62+
63+
release:
64+
github:
65+
owner: thanhdevapp
66+
name: dev-cleaner
67+
draft: false
68+
prerelease: auto
69+
name_template: "v{{.Version}}"
70+
71+
# Announce to social (optional)
72+
# announce:
73+
# twitter:
74+
# enabled: false

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 thanhdevapp
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)