Skip to content

Commit 2f322aa

Browse files
committed
Switch to fasthttp and fix lint
Signed-off-by: Joeky <joeky5888@gmail.com>
1 parent af25cc6 commit 2f322aa

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Go
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.25'
23+
24+
- name: Build
25+
run: go build -v ./...

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Latest Release
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
# https://github.com/softprops/action-gh-release/issues/236
16+
# GitHub release failed with status: 403
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
22+
release:
23+
strategy:
24+
matrix:
25+
# List of GOOS and GOARCH pairs from `go tool dist list`
26+
goosarch:
27+
- 'linux/amd64'
28+
- 'linux/arm64'
29+
- 'windows/amd64'
30+
- 'darwin/arm64'
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v4
37+
with:
38+
go-version: '1.25'
39+
40+
- name: Get OS and arch info
41+
run: |
42+
GOOSARCH=${{matrix.goosarch}}
43+
GOOS=${GOOSARCH%/*}
44+
GOARCH=${GOOSARCH#*/}
45+
PKG_NAME=""
46+
BINARY=""
47+
[ "$GOOS" = "windows" ] && PKG_NAME=${{ github.event.repository.name }}-$GOARCH-$GOOS.zip || PKG_NAME=${{ github.event.repository.name }}-$GOARCH-$GOOS.tar.gz
48+
[ "$GOOS" = "windows" ] && BINARY="${{ github.event.repository.name }}".exe || BINARY="${{ github.event.repository.name }}"
49+
echo "BINARY=$BINARY" >> $GITHUB_ENV
50+
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV
51+
echo "GOOS=$GOOS" >> $GITHUB_ENV
52+
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
53+
echo "CGO_ENABLED=0" >> $GITHUB_ENV
54+
55+
- name: Build
56+
run: |
57+
go build -ldflags "-s -w -X 'main.version=${{ github.ref_name }}'" -o "$BINARY" -v
58+
[ "$GOOS" = "windows" ] && zip "$PKG_NAME" "$BINARY" || tar zcvf "$PKG_NAME" "$BINARY"
59+
60+
- name: Release Notes
61+
run:
62+
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
63+
64+
- name: Release with Notes
65+
uses: softprops/action-gh-release@v1
66+
with:
67+
body_path: ".github/RELEASE-TEMPLATE.md"
68+
# draft: false
69+
files: ${{env.PKG_NAME}}
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)