Skip to content

Commit abe1dd0

Browse files
committed
ci: setup github action for releases
1 parent 880ef06 commit abe1dd0

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on version tags, e.g., v1.0.0
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
build:
11+
name: Build on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- os: ubuntu-latest
18+
artifact_name: fast-notepad-linux
19+
- os: windows-latest
20+
artifact_name: fast-notepad-windows.exe
21+
- os: macos-latest
22+
artifact_name: fast-notepad-macos
23+
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install Linux Dependencies
29+
if: runner.os == 'Linux'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev
33+
34+
- name: Configure CMake
35+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
36+
37+
- name: Build
38+
run: cmake --build build --config Release
39+
40+
- name: Prepare Artifact
41+
shell: bash
42+
run: |
43+
if [ "${{ runner.os }}" = "Windows" ]; then
44+
# Windows MSVC puts release builds in the Release subfolder
45+
cp build/Release/FastNotepad.exe ${{ matrix.artifact_name }}
46+
else
47+
cp build/FastNotepad ${{ matrix.artifact_name }}
48+
fi
49+
50+
- name: Upload Artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: ${{ matrix.artifact_name }}
54+
path: ${{ matrix.artifact_name }}
55+
56+
release:
57+
name: Create GitHub Release
58+
needs: build
59+
if: startsWith(github.ref, 'refs/tags/') # Only create release on tag push
60+
runs-on: ubuntu-latest
61+
permissions:
62+
contents: write
63+
steps:
64+
- name: Download Artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
path: artifacts
68+
merge-multiple: true
69+
70+
- name: Create Release
71+
uses: softprops/action-gh-release@v2
72+
with:
73+
files: artifacts/*
74+
generate_release_notes: true

0 commit comments

Comments
 (0)