55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # a full history is required for git-chglog
|
|
|
|
- name: Install Nix
|
|
uses: cachix/install-nix-action@v20
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
changelog=$(nix develop --impure --command git-chglog --next-tag=$(svu next))
|
|
echo "$changelog" > CHANGELOG.md
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$changelog" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build binaries
|
|
run: |
|
|
nix develop --impure --command bash -c '
|
|
export CGO_ENABLED=0
|
|
targets="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64"
|
|
for target in $targets; do
|
|
os=$(dirname $target)
|
|
arch=$(basename $target)
|
|
output_name="di-tui-${os}-${arch}"
|
|
echo "Building for $os/$arch..."
|
|
GOOS=$os GOARCH=$arch go build -o $output_name main.go
|
|
done
|
|
'
|
|
|
|
- name: Create Release
|
|
run: |
|
|
gh release create ${{ steps.version.outputs.version }} \
|
|
--title "${{ steps.version.outputs.version }}" \
|
|
--notes "${{ steps.changelog.outputs.changelog }}" \
|
|
di-tui-linux-amd64 \
|
|
di-tui-linux-arm64 \
|
|
di-tui-darwin-amd64 \
|
|
di-tui-darwin-arm64
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|