Skip to content

chore: update CHANGELOG for version 1.8.4 release, highlighting Super… #19

chore: update CHANGELOG for version 1.8.4 release, highlighting Super…

chore: update CHANGELOG for version 1.8.4 release, highlighting Super… #19

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+' # Releases like v1.6
- 'v[0-9]+.[0-9]+.[0-9]+' # Releases like v1.6.0
- 'v[0-9]+.[0-9]+-*' # Pre-releases like v1.6-beta.1
- 'v[0-9]+.[0-9]+.[0-9]+-*' # Pre-releases like v1.0.0-beta.1
permissions:
contents: write
env:
GO_VERSION: '1.26.2'
BINARY_NAME: goanime
jobs:
# =============================================================================
# Job 1: Run tests before building
# =============================================================================
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Verify dependencies
run: |
go mod verify
go mod download
- name: Run linter
uses: golangci/golangci-lint-action@v7
with:
version: v2.11.4
args: --timeout=15m
- name: Run tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... || true
- name: Check test coverage
run: |
if [ -f coverage.out ]; then
go tool cover -func=coverage.out || true
fi
echo "Coverage report generated"
- name: Build verification
run: |
# Verify the project builds successfully before proceeding
go build -v ./cmd/goanime
echo "Build verification passed"
- name: Upload coverage
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: coverage
path: coverage.out
retention-days: 7
- name: Test summary
if: always()
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Go Version: ${{ env.GO_VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "- Tests: Passed" >> $GITHUB_STEP_SUMMARY
echo "- Race Detection: Enabled" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# =============================================================================
# Job 2: Build cross-platform binaries with SQLite support (CGO enabled)
# =============================================================================
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
needs: test
strategy:
fail-fast: false
matrix:
include:
# Linux builds (native on ubuntu)
- os: linux
arch: amd64
runner: ubuntu-latest
ext: ''
cc: gcc
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
ext: ''
cc: gcc
# macOS builds (native on macos)
- os: darwin
arch: amd64
runner: macos-15
ext: ''
cc: clang
- os: darwin
arch: arm64
runner: macos-latest
ext: ''
cc: clang
# Windows builds (native on windows)
- os: windows
arch: amd64
runner: windows-latest
ext: '.exe'
cc: gcc
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install GCC (Windows)
if: matrix.os == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config
- name: Get version from tag
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build binary (Unix)
if: matrix.os != 'windows'
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 1
CC: ${{ matrix.cc }}
run: |
VERSION=${{ steps.version.outputs.VERSION }}
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
COMMIT=$(git rev-parse --short HEAD)
LDFLAGS="-s -w"
LDFLAGS="${LDFLAGS} -X github.com/alvarorichard/Goanime/internal/version.Version=${VERSION}"
LDFLAGS="${LDFLAGS} -X github.com/alvarorichard/Goanime/internal/version.BuildTime=${BUILD_TIME}"
LDFLAGS="${LDFLAGS} -X github.com/alvarorichard/Goanime/internal/version.Commit=${COMMIT}"
OUTPUT_NAME="${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}"
go build -ldflags "${LDFLAGS}" -o "dist/${OUTPUT_NAME}" ./cmd/goanime
echo "Built ${OUTPUT_NAME} with SQLite support"
- name: Build binary (Windows)
if: matrix.os == 'windows'
shell: pwsh
env:
CGO_ENABLED: 1
run: |
$env:PATH = "C:\msys64\mingw64\bin;$env:PATH"
$VERSION = "${{ steps.version.outputs.VERSION }}"
$BUILD_TIME = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ")
$COMMIT = git rev-parse --short HEAD
$LDFLAGS = "-s -w"
$LDFLAGS = "$LDFLAGS -X github.com/alvarorichard/Goanime/internal/version.Version=$VERSION"
$LDFLAGS = "$LDFLAGS -X github.com/alvarorichard/Goanime/internal/version.BuildTime=$BUILD_TIME"
$LDFLAGS = "$LDFLAGS -X github.com/alvarorichard/Goanime/internal/version.Commit=$COMMIT"
$OUTPUT_NAME = "${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}"
New-Item -ItemType Directory -Force -Path dist | Out-Null
go build -ldflags "$LDFLAGS" -o "dist/$OUTPUT_NAME" ./cmd/goanime
Write-Host "Built $OUTPUT_NAME with SQLite support"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
path: dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
retention-days: 1
# =============================================================================
# Job 3: Build Windows Installer using Inno Setup
# =============================================================================
windows-installer:
name: Build Windows Installer
runs-on: windows-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION_NUMBER=${VERSION#v}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT
- name: Download Windows amd64 binary
uses: actions/download-artifact@v4
with:
name: ${{ env.BINARY_NAME }}-windows-amd64
path: build/staging
- name: Rename binary for installer
shell: bash
run: |
mv build/staging/goanime-windows-amd64.exe build/staging/goanime.exe
- name: Download MPV for Windows
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create bin directory
New-Item -ItemType Directory -Force -Path build/staging/bin
# Get latest MPV release from GitHub (shinchiro builds - official recommended)
Write-Host "Fetching latest MPV release..."
$headers = @{ "User-Agent" = "GoAnime-CI" }
if ($env:GITHUB_TOKEN) {
$headers["Authorization"] = "Bearer $env:GITHUB_TOKEN"
}
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest" -Headers $headers
# Find the 64-bit release asset
$asset = $releases.assets | Where-Object { $_.name -match "mpv-x86_64-.*\.7z$" -and $_.name -notmatch "dev" } | Select-Object -First 1
if (-not $asset) {
Write-Error "Could not find MPV 64-bit release"
exit 1
}
$mpvUrl = $asset.browser_download_url
$mpvArchive = "mpv.7z"
Write-Host "Downloading MPV from: $mpvUrl"
Write-Host "Version: $($releases.tag_name)"
Invoke-WebRequest -Uri $mpvUrl -OutFile $mpvArchive -Headers @{ "Accept" = "application/octet-stream"; "User-Agent" = "GoAnime-CI" }
# Verify download
if (-not (Test-Path $mpvArchive) -or (Get-Item $mpvArchive).Length -lt 1000000) {
Write-Error "Download failed or file too small"
exit 1
}
Write-Host "Downloaded mpv archive ($(((Get-Item $mpvArchive).Length / 1MB).ToString('F2')) MB), extracting..."
# Extract MPV
7z x $mpvArchive -ompv_temp -y
# Find and copy mpv.exe and required DLLs (it might be in a subdirectory)
$mpvExe = Get-ChildItem -Path "mpv_temp" -Recurse -Filter "mpv.exe" | Select-Object -First 1
if ($mpvExe) {
$mpvDir = $mpvExe.DirectoryName
# Copy mpv.exe
Copy-Item $mpvExe.FullName "build/staging/bin/mpv.exe" -Force
Write-Host "MPV $($releases.tag_name) downloaded and staged successfully"
# Copy all required DLLs from the same directory
$dlls = Get-ChildItem -Path $mpvDir -Filter "*.dll" -ErrorAction SilentlyContinue
if ($dlls) {
foreach ($dll in $dlls) {
Copy-Item $dll.FullName -Destination "build/staging/bin/" -Force
Write-Host "Copied DLL: $($dll.Name)"
}
}
# Verify mpv works
& "build/staging/bin/mpv.exe" --version
} else {
Write-Error "mpv.exe not found in archive"
exit 1
}
# Cleanup
Remove-Item -Recurse -Force mpv_temp
Remove-Item $mpvArchive
- name: Update version in Inno Setup script
shell: pwsh
run: |
$version = "${{ steps.version.outputs.VERSION_NUMBER }}"
$issPath = "build/install.iss"
# Read the file
$content = Get-Content $issPath -Raw
# Update the version
$content = $content -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`""
# Write back
Set-Content $issPath $content
Write-Host "Updated install.iss with version $version"
- name: Build installer with Inno Setup
shell: pwsh
run: |
# Inno Setup is pre-installed on windows-latest runners
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" build/install.iss
# Check if installer was created
$installerPath = "dist/GoAnime-Installer-${{ steps.version.outputs.VERSION_NUMBER }}.exe"
if (Test-Path $installerPath) {
Write-Host "Installer created successfully: $installerPath"
Get-Item $installerPath | Select-Object Name, Length
} else {
Write-Error "Installer was not created!"
exit 1
}
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: windows-installer
path: dist/GoAnime-Installer-*.exe
retention-days: 1
# =============================================================================
# Job 4: Create release with all artifacts
# =============================================================================
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build, windows-installer]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION_NUMBER=${VERSION#v}" >> $GITHUB_OUTPUT
# Check if pre-release
if [[ "$VERSION" == *"-"* ]]; then
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: ${{ env.BINARY_NAME }}-*
merge-multiple: false
- name: Download Windows installer
uses: actions/download-artifact@v4
with:
name: windows-installer
path: artifacts/windows-installer
- name: Prepare release assets
run: |
mkdir -p release
# Move all binaries to release folder and create archives
for dir in artifacts/*/; do
if [ -d "$dir" ]; then
for file in "$dir"*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
cp "$file" "release/${filename}"
# Create tar.gz for Unix systems
if [[ "$filename" != *".exe" ]]; then
chmod +x "release/${filename}"
tar -czf "release/${filename}.tar.gz" -C release "${filename}"
fi
# Create zip for Windows binaries (not installer)
if [[ "$filename" == *".exe" ]] && [[ "$filename" != *"Installer"* ]]; then
(cd release && zip "${filename%.exe}.zip" "${filename}")
fi
fi
done
fi
done
echo "Release assets prepared:"
ls -la release/
- name: Generate checksums
run: |
cd release
# Generate SHA256 checksums for all files
sha256sum * > checksums-sha256.txt
# Generate SHA512 checksums for extra security
sha512sum * > checksums-sha512.txt
echo "Checksums generated:"
cat checksums-sha256.txt
- name: Generate changelog
id: changelog
run: |
VERSION=${{ steps.version.outputs.VERSION }}
# Check if manual CHANGELOG.md exists in repo root
if [ -f "CHANGELOG.md" ]; then
echo "Using manual CHANGELOG.md from repository"
cp CHANGELOG.md RELEASE_NOTES.md
else
echo "Generating changelog from commits"
# Get the previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
echo "## What's Changed in ${VERSION}" > RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
if [ -n "$PREV_TAG" ]; then
echo "### Commits since ${PREV_TAG}" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
# Group commits by type (conventional commits)
echo "#### Features" >> RELEASE_NOTES.md
git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --grep="^feat" >> RELEASE_NOTES.md || true
echo "" >> RELEASE_NOTES.md
echo "#### Bug Fixes" >> RELEASE_NOTES.md
git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --grep="^fix" >> RELEASE_NOTES.md || true
echo "" >> RELEASE_NOTES.md
echo "#### Documentation" >> RELEASE_NOTES.md
git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --grep="^docs" >> RELEASE_NOTES.md || true
echo "" >> RELEASE_NOTES.md
echo "#### Other Changes" >> RELEASE_NOTES.md
git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --invert-grep --grep="^feat\|^fix\|^docs" >> RELEASE_NOTES.md || true
echo "" >> RELEASE_NOTES.md
else
echo "Initial release" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
fi
fi
# Append installation instructions
echo "" >> RELEASE_NOTES.md
echo "---" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### Installation" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "#### Linux / macOS" >> RELEASE_NOTES.md
echo '```bash' >> RELEASE_NOTES.md
echo "# Download the binary for your platform" >> RELEASE_NOTES.md
echo "curl -LO https://github.com/alvarorichard/Goanime/releases/download/${VERSION}/goanime-linux-amd64.tar.gz" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "# Extract and install" >> RELEASE_NOTES.md
echo "tar -xzf goanime-linux-amd64.tar.gz" >> RELEASE_NOTES.md
echo "chmod +x goanime-linux-amd64" >> RELEASE_NOTES.md
echo "sudo mv goanime-linux-amd64 /usr/local/bin/goanime" >> RELEASE_NOTES.md
echo '```' >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "#### Windows" >> RELEASE_NOTES.md
echo "**Recommended:** Download and run the \`GoAnime-Installer-${VERSION#v}.exe\` for automatic setup with MPV included." >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "Or download the portable \`.zip\` file for your architecture and extract it." >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### Verification" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "Verify your download using the checksums:" >> RELEASE_NOTES.md
echo '```bash' >> RELEASE_NOTES.md
echo "sha256sum -c checksums-sha256.txt" >> RELEASE_NOTES.md
echo '```' >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "### Supported Platforms" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "| OS | Architecture | Binary |" >> RELEASE_NOTES.md
echo "|---|---|---|" >> RELEASE_NOTES.md
echo "| Linux | x86_64 | \`goanime-linux-amd64\` |" >> RELEASE_NOTES.md
echo "| Linux | ARM64 | \`goanime-linux-arm64\` |" >> RELEASE_NOTES.md
echo "| macOS | x86_64 (Intel) | \`goanime-darwin-amd64\` |" >> RELEASE_NOTES.md
echo "| macOS | ARM64 (Apple Silicon) | \`goanime-darwin-arm64\` |" >> RELEASE_NOTES.md
echo "| Windows | Installer | \`GoAnime-Installer-\${VERSION#v}.exe\` (Recommended) |" >> RELEASE_NOTES.md
echo "| Windows | x86_64 | \`goanime-windows-amd64.exe\` |" >> RELEASE_NOTES.md
echo "| Arch Linux | x86_64 | \`yay -S goanime\` (AUR) |" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
echo "All binaries are built with SQLite tracking support enabled." >> RELEASE_NOTES.md
cat RELEASE_NOTES.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: GoAnime ${{ steps.version.outputs.VERSION }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: ${{ steps.version.outputs.PRERELEASE }}
files: |
release/goanime-linux-amd64
release/goanime-linux-arm64
release/goanime-darwin-amd64
release/goanime-darwin-arm64
release/goanime-linux-amd64.tar.gz
release/goanime-linux-arm64.tar.gz
release/goanime-darwin-amd64.tar.gz
release/goanime-darwin-arm64.tar.gz
release/goanime-windows-amd64.zip
release/GoAnime-Installer-*.exe
release/checksums-sha256.txt
release/checksums-sha512.txt
fail_on_unmatched_files: false
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release summary
run: |
echo "## Release ${{ steps.version.outputs.VERSION }} created successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts:" >> $GITHUB_STEP_SUMMARY
ls -la release/*.tar.gz release/*.zip release/*.exe 2>/dev/null | awk '{print "- " $NF}' >> $GITHUB_STEP_SUMMARY || true
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Checksums:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat release/checksums-sha256.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
# =============================================================================
# Job 5: Publish to AUR (Arch User Repository)
# =============================================================================
aur-publish:
name: Publish to AUR
runs-on: ubuntu-latest
needs: release
if: ${{ !contains(github.ref, '-') }} # Skip pre-releases
steps:
- name: Check AUR secrets
id: check-secrets
run: |
if [ -z "${{ secrets.AUR_SSH_PRIVATE_KEY }}" ]; then
echo "AUR_SSH_PRIVATE_KEY not configured, skipping AUR publish"
echo "has_secrets=false" >> $GITHUB_OUTPUT
else
echo "has_secrets=true" >> $GITHUB_OUTPUT
fi
- name: Checkout code
if: steps.check-secrets.outputs.has_secrets == 'true'
uses: actions/checkout@v4
- name: Get version from tag
if: steps.check-secrets.outputs.has_secrets == 'true'
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION_NUMBER=${VERSION#v}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT
- name: Update PKGBUILD version
if: steps.check-secrets.outputs.has_secrets == 'true'
run: |
cd aur/goanime
sed -i "s/pkgver=.*/pkgver=${{ steps.version.outputs.VERSION_NUMBER }}/" PKGBUILD
sed -i "s/pkgrel=.*/pkgrel=1/" PKGBUILD
# Update source URL in PKGBUILD
sed -i "s|goanime-[0-9.]*::|goanime-${{ steps.version.outputs.VERSION_NUMBER }}::|" PKGBUILD
cat PKGBUILD
- name: Generate .SRCINFO
if: steps.check-secrets.outputs.has_secrets == 'true'
uses: docker://archlinux:latest
with:
entrypoint: bash
args: -c "pacman -Sy --noconfirm pacman-contrib base-devel && useradd -m builder && chown -R builder:builder /github/workspace && su builder -c 'cd /github/workspace/aur/goanime && makepkg --printsrcinfo > .SRCINFO && cat .SRCINFO'"
- name: Publish to AUR
if: steps.check-secrets.outputs.has_secrets == 'true'
uses: KSXGitHub/github-actions-deploy-aur@v4.1.2
with:
pkgname: goanime
pkgbuild: ./aur/goanime/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Update to ${{ steps.version.outputs.VERSION }}"
force_push: true
- name: AUR publish summary
if: steps.check-secrets.outputs.has_secrets == 'true'
run: |
echo "## AUR Package Updated" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Package: goanime" >> $GITHUB_STEP_SUMMARY
echo "- Version: ${{ steps.version.outputs.VERSION_NUMBER }}" >> $GITHUB_STEP_SUMMARY
echo "- AUR URL: https://aur.archlinux.org/packages/goanime" >> $GITHUB_STEP_SUMMARY