42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
# BlackRoad OS — Pave Tomorrow.
|
|
# Auto-create releases on tag push
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
if [ -n "$PREV_TAG" ]; then
|
|
CHANGES=$(git log $PREV_TAG..HEAD --pretty=format:"- %s (%h)" --no-merges)
|
|
else
|
|
CHANGES=$(git log --pretty=format:"- %s (%h)" --no-merges -20)
|
|
fi
|
|
echo "CHANGES<<EOF" >> $GITHUB_ENV
|
|
echo "$CHANGES" >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
|
|
- name: Create release
|
|
run: |
|
|
curl -s -X POST "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"tag_name\": \"${{ github.ref_name }}\",
|
|
\"name\": \"${{ github.ref_name }}\",
|
|
\"body\": \"## What's Changed\n${{ env.CHANGES }}\n\n---\n*BlackRoad OS — Pave Tomorrow.*\",
|
|
\"draft\": false,
|
|
\"prerelease\": false
|
|
}"
|