noctalia-shell/.github/workflows/release.yml

52 lines
No EOL
1.6 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create release archive
run: |
mkdir -p ../noctalia-release
rsync -av --exclude='.git' --exclude='.github' ./ ../noctalia-release/
cd ..
tar -czf noctalia-${{ github.ref_name }}.tar.gz noctalia-release/
cp noctalia-${{ github.ref_name }}.tar.gz noctalia-latest.tar.gz
mv *.tar.gz ${{ github.workspace }}/
- name: Generate release notes
run: |
PREV_TAG=$(git describe --tags --abbrev=0 ${{ github.ref }}^ 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
RANGE=$(git rev-list --max-parents=0 HEAD)..HEAD
else
RANGE=$PREV_TAG..HEAD
fi
echo "# Release ${{ github.ref_name }}" > release_notes.md
echo "" >> release_notes.md
echo "## Changes since $PREV_TAG" >> release_notes.md
echo "" >> release_notes.md
git log $RANGE --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H)) by %an" >> release_notes.md
echo "" >> release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
noctalia-${{ github.ref_name }}.tar.gz
noctalia-latest.tar.gz
body_path: release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}