Skip to content

Commit d4895dd

Browse files
authored
ci: add test and release workflows (#3)
* ci: add test workflow * ci: add release workflow with cross-platform builds
1 parent da75b16 commit d4895dd

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
include:
16+
- goos: linux
17+
goarch: amd64
18+
- goos: linux
19+
goarch: arm64
20+
- goos: darwin
21+
goarch: amd64
22+
- goos: darwin
23+
goarch: arm64
24+
- goos: windows
25+
goarch: amd64
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: actions/setup-go@v5
30+
with:
31+
go-version-file: go.mod
32+
33+
- name: Build
34+
env:
35+
GOOS: ${{ matrix.goos }}
36+
GOARCH: ${{ matrix.goarch }}
37+
run: |
38+
ext=""
39+
if [ "$GOOS" = "windows" ]; then ext=".exe"; fi
40+
go build -trimpath -ldflags="-s -w" -o "gh-enterprise-contribution-sync-${GOOS}-${GOARCH}${ext}" .
41+
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: gh-enterprise-contribution-sync-${{ matrix.goos }}-${{ matrix.goarch }}
46+
path: gh-enterprise-contribution-sync-*
47+
48+
publish:
49+
needs: release
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/download-artifact@v4
53+
with:
54+
merge-multiple: true
55+
56+
- name: Create GitHub Release
57+
env:
58+
GH_TOKEN: ${{ github.token }}
59+
TAG: ${{ github.ref_name }}
60+
run: gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --generate-notes gh-enterprise-contribution-sync-*

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
22+
- run: go vet ./...
23+
24+
- run: go build -o gh-enterprise-contribution-sync .

0 commit comments

Comments
 (0)