Skip to content

Commit bb6b232

Browse files
authored
Update go.yml
1 parent 78b6400 commit bb6b232

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

.github/workflows/go.yml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,69 @@ jobs:
3434
run: ./graph_algo -algo bellman-ford -size 100 -density 0.1
3535

3636
- name: Run Floyd-Warshall
37-
run: ./graph_algo -algo floyd-warshall -size 100 -density 0.1
37+
run: ./graph_algo -algo floyd-warshall -size 100 -density 0.1
38+
39+
release:
40+
name: Release Build
41+
runs-on: ubuntu-latest
42+
needs: build
43+
if: startsWith(github.ref, 'refs/tags/')
44+
45+
steps:
46+
- name: Check out code into the Go module directory
47+
uses: actions/checkout@v4
48+
49+
- name: Set up Go
50+
uses: actions/setup-go@v5
51+
with:
52+
go-version: ^1.16
53+
54+
- name: Build for Linux
55+
run: GOOS=linux GOARCH=amd64 go build -o parallel_graph_algorithms-linux-amd64 ./cmd/graph_algo
56+
57+
- name: Build for macOS
58+
run: GOOS=darwin GOARCH=amd64 go build -o parallel_graph_algorithms-darwin-amd64 ./cmd/graph_algo
59+
60+
- name: Build for Windows
61+
run: GOOS=windows GOARCH=amd64 go build -o parallel_graph_algorithms-windows-amd64.exe ./cmd/graph_algo
62+
63+
- name: Create Release
64+
id: create_release
65+
uses: actions/create-release@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
tag_name: ${{ github.ref_name }}
70+
release_name: Release ${{ github.ref_name }}
71+
draft: false
72+
prerelease: false
73+
74+
- name: Upload Linux Build
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
upload_url: ${{ steps.create_release.outputs.upload_url }}
80+
asset_path: ./parallel_graph_algorithms-linux-amd64
81+
asset_name: parallel_graph_algorithms-linux-amd64
82+
asset_content_type: application/octet-stream
83+
84+
- name: Upload macOS Build
85+
uses: actions/upload-release-asset@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
upload_url: ${{ steps.create_release.outputs.upload_url }}
90+
asset_path: ./parallel_graph_algorithms-darwin-amd64
91+
asset_name: parallel_graph_algorithms-darwin-amd64
92+
asset_content_type: application/octet-stream
93+
94+
- name: Upload Windows Build
95+
uses: actions/upload-release-asset@v1
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
with:
99+
upload_url: ${{ steps.create_release.outputs.upload_url }}
100+
asset_path: ./parallel_graph_algorithms-windows-amd64.exe
101+
asset_name: parallel_graph_algorithms-windows-amd64.exe
102+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)