Skip to content

Commit ff9e521

Browse files
authored
Enhance GitHub Actions for Go builds and releases
Updated Go CI workflow to build for multiple OS and versions.
1 parent 575d24d commit ff9e521

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

.github/workflows/go.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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: [ "master" ]
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: '1.21'
24+
25+
- name: Build for Windows
26+
run: GOOS=windows GOARCH=amd64 go build -o ${{ github.event.repository.name }}.exe
27+
28+
- name: Build for macOS
29+
run: GOOS=darwin GOARCH=amd64 go build -o ${{ github.event.repository.name }}_macos
30+
31+
- name: Build for Linux
32+
run: GOOS=linux GOARCH=amd64 go build -o ${{ github.event.repository.name }}_linux
33+
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: v1.0.0
41+
release_name: Release v1.0.0 - ${{ github.event.repository.name }}
42+
body: |
43+
- Compare file via the CLI itself with --reference and given files as argument.
44+
- Compare files with a configuration files, utilizing patterns the subfolders.
45+
draft: false
46+
prerelease: false
47+
48+
- name: Upload Release Assets
49+
id: upload_release_assets
50+
uses: actions/upload-release-asset@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
upload_url: ${{ steps.create_release.outputs.upload_url }}
55+
asset_path: ./${{ github.event.repository.name }}.exe
56+
asset_name: ${{ github.event.repository.name }}.exe
57+
asset_content_type: application/octet-stream
58+
59+
- name: Upload MacOS Release Assets
60+
id: upload_release_assets_macos
61+
uses: actions/upload-release-asset@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ steps.create_release.outputs.upload_url }}
66+
asset_path: ./${{ github.event.repository.name }}_macos
67+
asset_name: ${{ github.event.repository.name }}_macos
68+
asset_content_type: application/octet-stream
69+
70+
- name: Upload Linux Release Assets
71+
id: upload_release_assets_linux
72+
uses: actions/upload-release-asset@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
upload_url: ${{ steps.create_release.outputs.upload_url }}
77+
asset_path: ./${{ github.event.repository.name }}_linux
78+
asset_name: ${{ github.event.repository.name }}_linux
79+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)