Skip to content

Commit aeeeec3

Browse files
committed
Add GitHub Actions workflow for release automation
1 parent d7d3081 commit aeeeec3

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
tag_name: ${{ steps.tag.outputs.tag_name }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Get tag name
17+
id: tag
18+
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
19+
20+
- name: Create Release
21+
run: |
22+
gh release create ${{ steps.tag.outputs.tag_name }} \
23+
--title "Release ${{ steps.tag.outputs.tag_name }}" \
24+
--generate-notes \
25+
--draft=false \
26+
--prerelease=false
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
build-and-upload:
31+
needs: create-release
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- os: ubuntu-latest
37+
target: x86_64-unknown-linux-gnu
38+
artifact_name: linux-x86_64
39+
- os: macos-latest
40+
target: aarch64-apple-darwin
41+
artifact_name: macos-arm64
42+
43+
runs-on: ${{ matrix.os }}
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install Nix
49+
uses: DeterminateSystems/nix-installer-action@main
50+
51+
- name: Enable Magic Nix Cache
52+
uses: DeterminateSystems/magic-nix-cache-action@main
53+
54+
- name: Build
55+
run: nix build .#static -o release
56+
57+
- name: Windows build
58+
if: matrix.os == 'ubuntu-latest'
59+
run: nix build .#windows -o release_win
60+
61+
- name: Create archives and upload (Unix)
62+
run: |
63+
# Create individual archives for each tool
64+
for tool in ffmpegthumbnailer; do
65+
mkdir -p ${tool}-temp
66+
cp release/bin/${tool} ${tool}-temp/
67+
tar -czf ${tool}-${{ matrix.artifact_name }}.tar.gz -C ${tool}-temp ${tool}
68+
rm -rf ${tool}-temp
69+
gh release upload ${{ needs.create-release.outputs.tag_name }} ${tool}-${{ matrix.artifact_name }}.tar.gz
70+
done
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Create and upload Windows cross compile
75+
if: matrix.os == 'ubuntu-latest'
76+
run: |
77+
# Create individual archives for each tool
78+
for tool in ffmpegthumbnailer; do
79+
mkdir -p ${tool}-temp
80+
cp release_win/bin/${tool}.exe ${tool}-temp/
81+
tar -czf ${tool}-windows-mingw64.tar.gz -C ${tool}-temp ${tool}
82+
rm -rf ${tool}-temp
83+
gh release upload ${{ needs.create-release.outputs.tag_name }} ${tool}-windows-mingw64.tar.gz
84+
done
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)