Skip to content

Commit 72f4f90

Browse files
committed
actions: add release to job
1 parent da106a4 commit 72f4f90

File tree

2 files changed

+42
-52
lines changed

2 files changed

+42
-52
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
name: Build
1+
name: Build and Release
22

33
on:
44
push: {}
55
pull_request: {}
6+
workflow_dispatch:
67

78
jobs:
89
build:
910
runs-on: ubuntu-22.04
1011
steps:
1112
- name: Checkout code
1213
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
1316

1417
- name: Set up Go
1518
uses: actions/setup-go@v4
@@ -69,4 +72,41 @@ jobs:
6972
with:
7073
name: built-binaries
7174
path: bin/
72-
retention-days: 5
75+
retention-days: 5
76+
77+
- name: Get tag version (if tag push)
78+
if: startsWith(github.ref, 'refs/tags/')
79+
id: get_version
80+
run: |
81+
TAG_VERSION=${GITHUB_REF#refs/tags/}
82+
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
83+
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
84+
85+
release:
86+
if: startsWith(github.ref, 'refs/tags/')
87+
needs: [build]
88+
runs-on: ubuntu-22.04
89+
steps:
90+
- name: Download artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: built-binaries
94+
path: bin
95+
96+
- name: Create GitHub Release
97+
uses: softprops/action-gh-release@v2
98+
with:
99+
tag_name: ${{ needs.build.outputs.tag_version }}
100+
name: Release ${{ needs.build.outputs.tag_version }}
101+
body: |
102+
## Pre-built binaries
103+
- Static libraries (.a files)
104+
- Header files (.h files)
105+
106+
Built from tag: ${{ needs.build.outputs.tag_version }}
107+
files: |
108+
bin/*.a
109+
bin/*.h
110+
generate_release_notes: true
111+
draft: false
112+
prerelease: false

.github/workflows/release.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)