Skip to content

Commit

Permalink
Deduce artifact version+release notes
Browse files Browse the repository at this point in the history
Since we're using Nerdbank.Gitversioning anyhow, let's use the data
it generates.
  • Loading branch information
paralaxsd committed Dec 19, 2024
1 parent 52b6886 commit 3100809
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@ name: Make Release
on:
workflow_dispatch:
inputs:
release_name:
description: 'Release name (e.g., v1.0.0)'
required: true
release_body:
description: 'Description of the release'
required: false
prerelease:
description: 'Mark as pre-release'
required: false
default: 'false'

# Add these crucial permissions
permissions:
contents: write

Expand All @@ -25,6 +18,29 @@ jobs:
with:
fetch-depth: 0

- name: Get Version
id: version
shell: pwsh
run: |
# Run nbgv through dotnet
$version = dotnet nbgv get-version --variable SemVer2
echo "VERSION=$version" >> $env:GITHUB_ENV
- name: Generate Release Notes
id: release_notes
run: |
# Get commits since last release
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
COMMITS=$(git log --pretty=format:"* %s by @%an" --reverse)
else
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"* %s by @%an" --reverse)
fi
echo "COMMITS<<EOF" >> $GITHUB_OUTPUT
echo "## What's Changed" >> $GITHUB_OUTPUT
echo "$COMMITS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
Expand All @@ -39,40 +55,30 @@ jobs:
- name: Compress Linux Artifacts
run: |
mkdir -p ./release-assets
tar -czvf ./release-assets/linux-artifact.tar.gz -C artifacts/linux .
tar -czvf "./release-assets/hetzerize-linux-${VERSION}.tar.gz" -C artifacts/linux .
sha256sum "./release-assets/hetzerize-linux-${VERSION}.tar.gz" > "./release-assets/hetzerize-linux-${VERSION}.tar.gz.sha256"
- name: Compress Windows Artifacts
run: |
zip -r ./release-assets/win-artifact.zip artifacts/win
zip -r "./release-assets/hetzerize-windows-${VERSION}.zip" artifacts/win
sha256sum "./release-assets/hetzerize-windows-${VERSION}.zip" > "./release-assets/hetzerize-windows-${VERSION}.zip.sha256"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.release_name }}
release_name: ${{ github.event.inputs.release_name }}
body: ${{ github.event.inputs.release_body }}
tag_name: v${VERSION}
release_name: Release v${VERSION}
body: ${{ steps.release_notes.outputs.COMMITS }}
draft: false
prerelease: ${{ github.event.inputs.prerelease }}

- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/linux-artifact.tar.gz
asset_name: linux-artifact.tar.gz
asset_content_type: application/gzip

- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/win-artifact.zip
asset_name: win-artifact.zip
asset_content_type: application/zip
files: |
./release-assets/*
tag_name: v${VERSION}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3100809

Please sign in to comment.