62 lines
2.1 KiB
YAML
62 lines
2.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0 # a full history is required for git-chglog
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- name: Generate changelog
|
|
id: changelog
|
|
shell: bash -c "nix develop --impure -c bash -- {0}"
|
|
run: |
|
|
git config --global user.email "actions@github.com"
|
|
git config --global user.name "Github Actions"
|
|
OLD_TAG=$(svu current --strip-prefix)
|
|
NEW_TAG=$(svu next --strip-prefix)
|
|
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
|
|
sed -i "s/$OLD_TAG/$NEW_TAG/g" default.nix
|
|
sed -i "s/$OLD_TAG/$NEW_TAG/g" main.go
|
|
full_changelog=$(git-chglog --next-tag=v$NEW_TAG)
|
|
echo "$full_changelog" > CHANGELOG.md
|
|
git add default.nix
|
|
git add main.go
|
|
git add CHANGELOG.md
|
|
git commit -m "bump di-tui version" --allow-empty
|
|
- name: Build binaries
|
|
shell: bash -c "nix develop --impure -c bash -- {0}"
|
|
run: |
|
|
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
|
|
shell: bash -c "nix develop --impure -c bash -- {0}"
|
|
run: |
|
|
version=$(svu next)
|
|
changelog=$(git-chglog --next-tag=$version $version)
|
|
git push
|
|
git push --tags
|
|
gh release create $version \
|
|
--title "$version" \
|
|
--notes "$changelog" \
|
|
di-tui-linux-amd64 \
|
|
di-tui-linux-arm64 \
|
|
di-tui-darwin-amd64 \
|
|
di-tui-darwin-arm64
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|