Skip to content

Commit cd7ae6d

Browse files
committed
ci: Add GoReleaser configuration and GitHub Actions workflow for artifact uploads
Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 36e2341 commit cd7ae6d

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

.github/workflows/artifacts.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Artifacts
3+
4+
on:
5+
release:
6+
types:
7+
- published
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
security-events: write
14+
id-token: write
15+
16+
jobs:
17+
upload_artifacts:
18+
name: Upload Artifacts
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4.2.2
23+
with:
24+
ref: ${{ github.ref }}
25+
fetch-depth: 0
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v5.5.0
29+
with:
30+
go-version: '1.24'
31+
cache: true
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3.10.0
35+
with:
36+
version: latest
37+
38+
- name: Install GoReleaser
39+
run: |
40+
curl -sSL https://github.com/goreleaser/goreleaser/releases/download/v2.7.0/goreleaser_Linux_x86_64.tar.gz | tar -xzv -C /usr/local/bin goreleaser
41+
42+
- name: Login to GitHub Container Registry
43+
uses: docker/login-action@v3.4.0
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Run GoReleaser
50+
run: |
51+
goreleaser release --clean
52+
53+
- name: Upload Artifacts to Release
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
VERSION: ${{ github.event.release.tag_name }}
57+
run: |
58+
for file in dist/a2a_*; do
59+
if [ -d "$file" ]; then
60+
echo "Skipping directory: $file"
61+
continue
62+
fi
63+
64+
echo "Uploading $file to release ${{ env.VERSION }}"
65+
gh release upload ${{ env.VERSION }} "$file" --clobber
66+
done
67+
68+
if [ -f "dist/checksums.txt" ]; then
69+
gh release upload ${{ env.VERSION }} "dist/checksums.txt" --clobber
70+
fi

.goreleaser.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
---
3+
version: 2
4+
5+
project_name: a2a-cli
6+
7+
before:
8+
hooks:
9+
- go mod tidy
10+
11+
builds:
12+
- id: a2a-cli
13+
main: .
14+
env:
15+
- CGO_ENABLED=0
16+
goos:
17+
- linux
18+
- darwin
19+
goarch:
20+
- amd64
21+
- arm64
22+
goarm:
23+
- '7'
24+
goamd64:
25+
- 'v1'
26+
mod_timestamp: '{{ .CommitTimestamp }}'
27+
flags:
28+
- -trimpath
29+
ldflags:
30+
- -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }}
31+
32+
archives:
33+
- formats:
34+
- tar.gz
35+
name_template: >-
36+
{{ .ProjectName }}_
37+
{{- title .Os }}_
38+
{{- if eq .Arch "amd64" }}x86_64
39+
{{- else }}{{ .Arch }}{{ end }}
40+
{{- if .Arm }}v{{ .Arm }}{{ end }}
41+
files:
42+
- README.md
43+
- LICENSE
44+
- CHANGELOG.md
45+
46+
checksum:
47+
name_template: 'checksums.txt'
48+
49+
changelog:
50+
disable: true
51+
52+
release:
53+
disable: true

0 commit comments

Comments
 (0)