Skip to content

Commit 475efb5

Browse files
committed
ci: add Go module release workflow
- Adds new go-release.yml workflow for creating Go module releases - Renames go.yml to go-test.yml for clarity - Improves tag pattern for FFmpeg release to be more specific - Updates description field in FFmpeg workflow - Adds justfile commands for Go module release management This provides proper release automation for the Go module alongside the existing FFmpeg library release process.
1 parent 151f77b commit 475efb5

4 files changed

Lines changed: 116 additions & 2 deletions

File tree

.github/workflows/ffmpeg-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Library version (e.g., 8.0.0.0)'
7+
description: 'FFmpeg library version (e.g., 8.0.0.1)'
88
required: true
99
push:
1010
tags:
11-
- 'lib-*'
11+
- 'lib-[0-9]*.[0-9]*.[0-9]*.[0-9]*'
1212

1313
permissions:
1414
pull-requests: write

.github/workflows/go-release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Go module release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Go module version (e.g., 8.0.0.1)'
8+
required: true
9+
push:
10+
tags:
11+
- 'v[0-9]*.[0-9]*.[0-9]*.[0-9]*'
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
release:
18+
name: Create Go module release
19+
runs-on: ubuntu-24.04
20+
21+
steps:
22+
- name: Validate version format
23+
if: github.event_name == 'workflow_dispatch'
24+
run: |
25+
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
26+
echo "Error: Version must be in format X.Y.Z.N (e.g., 8.0.0.1)"
27+
exit 1
28+
fi
29+
30+
- uses: actions/checkout@v6
31+
with:
32+
fetch-depth: 0
33+
34+
- uses: actions/setup-go@v6
35+
with:
36+
go-version: '1.24'
37+
cache: true
38+
39+
- name: Verify module builds
40+
run: go build -v ./...
41+
42+
- name: Run tests
43+
run: |
44+
go run ./cmd/download-lib/
45+
go test -v ./...
46+
47+
- name: Create tag (workflow_dispatch only)
48+
if: github.event_name == 'workflow_dispatch'
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "github-actions[bot]@users.noreply.github.com"
52+
# Go modules require v prefix for version tags
53+
git tag -a "v${{ inputs.version }}" -m "Release ${{ inputs.version }}"
54+
git push origin "v${{ inputs.version }}"
55+
56+
- name: Determine version
57+
id: version
58+
run: |
59+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
60+
echo "version=v${{ inputs.version }}" >> $GITHUB_OUTPUT
61+
echo "display_version=${{ inputs.version }}" >> $GITHUB_OUTPUT
62+
else
63+
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
64+
echo "display_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
65+
fi
66+
67+
- name: Generate changelog
68+
id: changelog
69+
run: |
70+
VERSION="${{ steps.version.outputs.version }}"
71+
DISPLAY_VERSION="${{ steps.version.outputs.display_version }}"
72+
73+
# Get previous tag (look for v8.* tags)
74+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' || echo "")
75+
76+
if [ -n "$PREV_TAG" ]; then
77+
echo "Generating changelog from $PREV_TAG to $VERSION"
78+
COMMITS=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG"..HEAD --no-merges)
79+
else
80+
echo "No previous version tag found, using recent commits"
81+
COMMITS=$(git log --pretty=format:"- %s (%h)" -20 --no-merges)
82+
fi
83+
84+
# Write changelog to file (handles multiline)
85+
{
86+
echo "## What's Changed"
87+
echo ""
88+
echo "$COMMITS"
89+
echo ""
90+
echo "## Installation"
91+
echo ""
92+
echo '```bash'
93+
echo "go get github.com/linuxmatters/ffmpeg-statigo@$VERSION"
94+
echo '```'
95+
echo ""
96+
echo "**Full Changelog**: https://github.com/linuxmatters/ffmpeg-statigo/compare/${PREV_TAG:-main}...$VERSION"
97+
} > changelog.md
98+
99+
- name: Create GitHub Release
100+
uses: softprops/action-gh-release@v2
101+
with:
102+
tag_name: ${{ steps.version.outputs.version }}
103+
name: ${{ steps.version.outputs.display_version }}
104+
body_path: changelog.md
105+
draft: false
106+
prerelease: false

justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ ffmpeg-release VERSION:
5656
# Check library release workflow status
5757
ffmpeg-release-status:
5858
gh run list --workflow=ffmpeg-release.yml --limit 5
59+
60+
# Trigger Go module release
61+
go-release VERSION:
62+
gh workflow run go-release.yml -f version={{VERSION}}
63+
64+
# Check Go module release workflow status
65+
go-release-status:
66+
gh run list --workflow=go-release.yml --limit 5

0 commit comments

Comments
 (0)