Skip to content

Commit 54b1f4a

Browse files
committed
feat: update cli & rename project
1 parent 407ef3d commit 54b1f4a

30 files changed

+1098
-1059
lines changed

.dockerignore

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
.git/
2-
.gitignore
3-
bin/
1+
/.git
2+
/.github
3+
/.gitignore
4+
/Dockerfile
5+
/build
46
README.md

.github/release-drafter.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
change-template: '* $TITLE (#$NUMBER) by @$AUTHOR'
4+
template: |
5+
$CHANGES
6+
7+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
8+
9+
sort-direction: ascending
10+
11+
categories:
12+
- title: '⚠️ BREAKING CHANGES'
13+
label: 'breaking'
14+
- title: '💫 Features'
15+
label: 'feature'
16+
- title: '🛠️ Bug fixes'
17+
label: 'fix'
18+
- title: '🕹️ Others'
19+
label: 'chore'
20+
21+
version-resolver:
22+
# Major is not meant to be used at the moment.
23+
# Should be used with label breaking in the future.
24+
major:
25+
labels:
26+
- 'major'
27+
minor:
28+
labels:
29+
- 'breaking'
30+
- 'feature'
31+
- 'chore'
32+
patch:
33+
labels:
34+
- 'fix'
35+
36+
exclude-labels:
37+
- 'skip-changelog'
38+
39+
autolabeler:
40+
- label: 'breaking'
41+
title:
42+
- '/!:/i'
43+
- label: 'chore'
44+
title:
45+
- '/^chore/i'
46+
- label: 'fix'
47+
title:
48+
- '/^fix/i'
49+
- label: 'feature'
50+
title:
51+
- '/^feat/i'

.github/workflows/docker.yaml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'pkg/**'
9+
- '*.go'
10+
- 'go.*'
11+
- Dockerfile
12+
- .github/workflows/docker.yaml
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- 'pkg/**'
18+
- '*.go'
19+
- 'go.*'
20+
- Dockerfile
21+
- .github/workflows/docker.yaml
22+
release:
23+
types:
24+
- published
25+
26+
env:
27+
REGISTRY: ghcr.io
28+
IMAGE_NAME: ${{ github.repository }}
29+
PLATFORMS: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
30+
31+
jobs:
32+
build:
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
packages: write
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
fetch-tags: true
44+
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v2
47+
48+
- name: "Generate Build ID (main)"
49+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
50+
run: |
51+
branch=${GITHUB_REF##*/}
52+
sha=${GITHUB_SHA::8}
53+
ts=$(date +%s)
54+
echo "BUILD_ID=${branch}-${ts}-${sha}" >> $GITHUB_ENV
55+
56+
- name: "Generate Build ID (PR)"
57+
if: github.event_name == 'pull_request'
58+
run: |
59+
echo "BUILD_ID=pr-${{ github.event.number }}-$GITHUB_RUN_ID" >> $GITHUB_ENV
60+
61+
- name: "Generate Build ID (Release)"
62+
if: github.event_name == 'release'
63+
run: |
64+
echo "BUILD_ID=${GITHUB_REF##*/}" >> $GITHUB_ENV
65+
66+
- name: 'Generate App Version'
67+
run: echo "VERSION=$(make version)" >> $GITHUB_ENV
68+
69+
- name: Log in to the Container registry
70+
uses: docker/login-action@v2
71+
with:
72+
registry: ${{ env.REGISTRY }}
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@v2
78+
79+
- name: Extract metadata (tags, labels) for Docker
80+
id: meta
81+
uses: docker/metadata-action@v4
82+
with:
83+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
84+
tags: |
85+
type=ref,event=pr
86+
type=ref,event=branch
87+
type=raw,value=${{ env.BUILD_ID }}
88+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
89+
90+
- name: Build and push Docker image
91+
uses: docker/build-push-action@v4
92+
with:
93+
context: .
94+
push: true
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}
97+
platforms: ${{ env.PLATFORMS }}
98+
cache-from: type=gha
99+
cache-to: type=gha,mode=max
100+
build-args: |
101+
VERSION=${{ env.VERSION }}

.github/workflows/docker.yml

-42
This file was deleted.

.github/workflows/pr-title.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Validate PR title'
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
types: [ opened, reopened, synchronize ]
7+
8+
permissions:
9+
pull-requests: read
10+
statuses: write
11+
12+
jobs:
13+
main:
14+
name: Validate PR title
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Please look up the latest version from
18+
# https://github.com/amannn/action-semantic-pull-request/releases
19+
- uses: amannn/action-semantic-pull-request@v5
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
types: |
24+
fix
25+
feat
26+
chore
27+
requireScope: false
28+
wip: true
29+
validateSingleCommit: false
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
types: [ opened, reopened, synchronize ]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
update_release_draft:
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: release-drafter/release-drafter@v5
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
releases-matrix:
13+
name: Release Go Binary
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
goos: [linux, windows, darwin]
18+
goarch: ["386", amd64, arm64]
19+
exclude:
20+
- goarch: "386"
21+
goos: darwin
22+
- goarch: arm64
23+
goos: windows
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
fetch-tags: true
29+
30+
- uses: wangyoucao577/go-release-action@v1
31+
env:
32+
BUILD_FOLDER: .
33+
with:
34+
build_command: make build
35+
extra_files: LICENSE README.md
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
goos: ${{ matrix.goos }}
38+
goarch: ${{ matrix.goarch }}
39+
goversion: "1.20"
40+
md5sum: false

.github/workflows/release.yml

-33
This file was deleted.

.github/workflows/test.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'pkg/**'
9+
- '*.go'
10+
- 'go.*'
11+
- '.github/workflows/test.yaml'
12+
pull_request:
13+
paths:
14+
- 'pkg/**'
15+
- '*.go'
16+
- 'go.*'
17+
- '.github/workflows/test.yaml'
18+
19+
env:
20+
GO_VERSION: "1.20"
21+
22+
jobs:
23+
unit-tests:
24+
name: 'Unit tests'
25+
runs-on: ubuntu-20.04
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: actions/setup-go@v4
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
33+
- id: go-cache-paths
34+
run: |
35+
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
36+
37+
# Cache go mod cache to speedup deps downloads
38+
- uses: actions/cache@v3
39+
with:
40+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
41+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
42+
restore-keys: ${{ runner.os }}-go-mod-
43+
44+
- name: 'Run unit tests'
45+
run: |
46+
make test

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dist/
1+
/build

0 commit comments

Comments
 (0)