Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: | | |
VERSION=$(git describe --tags | tr -d 'v') | |
mkdir -p builds | |
# Create Release directory structure for each platform | |
mkdir -p builds/Release/linux_amd64 | |
mkdir -p builds/Release/windows_amd64 | |
mkdir -p builds/Release/darwin_amd64 | |
# Copy config and templates to each platform directory | |
for platform in linux_amd64 windows_amd64 darwin_amd64; do | |
cp config.toml builds/Release/${platform}/ | |
cp -r templates builds/Release/${platform}/ | |
done | |
# Binary builds with platform-specific directories | |
GOOS=linux GOARCH=amd64 go build -o builds/Release/linux_amd64/lilmail | |
GOOS=windows GOARCH=amd64 go build -o builds/Release/windows_amd64/lilmail.exe | |
GOOS=darwin GOARCH=amd64 go build -o builds/Release/darwin_amd64/lilmail | |
# Create archives for each platform | |
cd builds | |
zip -r lilmail${VERSION}_linux_amd64.zip Release/linux_amd64/* | |
zip -r lilmail${VERSION}_windows_amd64.zip Release/windows_amd64/* | |
zip -r lilmail${VERSION}_darwin_amd64.zip Release/darwin_amd64/* | |
# Source archive including config and templates | |
cd .. | |
mkdir -p builds/Release/source | |
git archive --format=zip HEAD -o builds/Release/source/source.zip | |
cd builds | |
zip -r lilmail${VERSION}_source.zip Release/source/* | |
# Clean up build directories | |
rm -rf builds/Release | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: builds/* |