Skip to content

Commit c5b612a

Browse files
committed
ci: upgrade release CI
CI now creates a release on tags CI now uploads binaries to release on tags
1 parent 9530600 commit c5b612a

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,62 @@ on:
66
- "[0-9]+.[0-9]+.[0-9]+"
77

88
jobs:
9-
build-and-push:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Create GitHub Release
18+
id: create_release
19+
uses: actions/create-release@v1
20+
with:
21+
tag_name: ${{ github.ref_name }}
22+
release_name: ${{ github.ref_name }}
23+
draft: false
24+
prerelease: false
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
outputs:
28+
upload_url: ${{ steps.create_release.outputs.upload_url }}
29+
30+
release-binary:
31+
needs: release
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
os: [linux, windows, darwin]
36+
arch: [amd64, arm64]
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: 1.24.2
45+
46+
- name: Build
47+
run: go mod tidy && go build -ldflags "-X main.version=${{ github.ref_name }}" -o gitlab-sync_${{ matrix.os }}_${{ matrix.arch }} cmd/main.go
48+
env:
49+
GOOS: ${{ matrix.os }}
50+
GOARCH: ${{ matrix.arch }}
51+
CGO_ENABLED: 0
52+
GO111MODULE: on
53+
54+
- name: Upload binaries
55+
uses: actions/upload-release-asset@v1
56+
with:
57+
upload_url: ${{ needs.release.outputs.upload_url }}
58+
asset_path: ./gitlab-sync_${{ matrix.os }}_${{ matrix.arch }}
59+
asset_name: gitlab-sync_${{ github.ref_name }}_${{ matrix.os }}_${{ matrix.arch }}
60+
asset_content_type: application/octet-stream
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
64+
release-oci:
1065
runs-on: ubuntu-latest
1166
steps:
1267
- name: Check out code

0 commit comments

Comments
 (0)