Skip to content

Commit 1e7d76e

Browse files
authored
Refactor build workflow for releases and artifact handling
Updated the GitHub Actions workflow to trigger on tag pushes, added a release creation step, and modified artifact upload steps.
1 parent 64b7ea8 commit 1e7d76e

1 file changed

Lines changed: 33 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Build Binaries
1+
name: Release Binaries
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
8-
workflow_dispatch:
5+
tags:
6+
- 'v*' # Trigger on vx.x.x
7+
8+
permissions:
9+
contents: write # Required to create a release and upload assets
910

1011
jobs:
1112
build:
@@ -15,28 +16,45 @@ jobs:
1516
matrix:
1617
include:
1718
- os: ubuntu-latest
18-
artifact_name: bbfmux-linux
1919
binary_name: bbfmux
2020
compile_cmd: g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux -pthread
2121
- os: windows-latest
22-
artifact_name: bbfmux-windows
2322
binary_name: bbfmux.exe
2423
compile_cmd: g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux.exe -municode
2524

2625
steps:
2726
- name: Checkout code
2827
uses: actions/checkout@v4
2928

30-
- name: Compile (Linux)
31-
if: runner.os == 'Linux'
32-
run: ${{ matrix.compile_cmd }}
33-
34-
- name: Compile (Windows)
35-
if: runner.os == 'Windows'
29+
- name: Compile
3630
run: ${{ matrix.compile_cmd }}
3731

38-
- name: Upload Artifact
32+
- name: Upload temporary artifact
3933
uses: actions/upload-artifact@v4
4034
with:
41-
name: ${{ matrix.artifact_name }}
35+
name: ${{ matrix.os }}-bin
4236
path: ${{ matrix.binary_name }}
37+
38+
create_release:
39+
name: Create GitHub Release
40+
needs: build
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Download all artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
path: bin-temp
50+
merge-multiple: true
51+
52+
- name: Create Release and Upload Assets
53+
uses: softprops/action-gh-release@v2
54+
with:
55+
files: |
56+
bin-temp/bbfmux
57+
bin-temp/bbfmux.exe
58+
generate_release_notes: true # Automatically summarizes commits since last release
59+
draft: false
60+
prerelease: false

0 commit comments

Comments
 (0)