Skip to content

Commit cd16414

Browse files
committed
feat: migrating from travis to github actions
Signed-off-by: abzcoding <[email protected]>
1 parent 1153b76 commit cd16414

File tree

3 files changed

+80
-7
lines changed

3 files changed

+80
-7
lines changed

.github/workflows/go.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
go-version: ['1.23']
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
24+
- name: Go Cache
25+
uses: actions/cache@v3
26+
with:
27+
path: |
28+
~/.cache/go-build
29+
~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
33+
34+
- name: Security Scan
35+
if: matrix.os == 'ubuntu-latest'
36+
uses: securego/gosec@master
37+
with:
38+
args: ./...
39+
40+
- name: Build
41+
run: go build -v -ldflags "-X main.GitCommit=$(git describe --always)" -o bin/hget
42+
43+
- name: Test
44+
run: go test -v ./...
45+
46+
- name: Upload Build Artifact
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: hget-${{ runner.os }}
50+
path: bin/hget
51+
if-no-files-found: error

.github/workflows/release.yml

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

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)