57 lines
1.8 KiB
YAML
57 lines
1.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.VERSION }}
|
|
changelog: ${{ steps.changelog.outputs.CHANGES }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get version from tag
|
|
id: get_version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Verify version match
|
|
run: |
|
|
PIO_VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
|
|
TAG_VERSION=${{ steps.get_version.outputs.VERSION }}
|
|
|
|
if [ "$PIO_VERSION" != "$TAG_VERSION" ]; then
|
|
echo "Error: Version mismatch between tag ($TAG_VERSION) and platformio.ini ($PIO_VERSION)"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Read CHANGELOG.md
|
|
id: changelog
|
|
run: |
|
|
CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.VERSION }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
|
|
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Determine provider
|
|
id: detect-provider
|
|
run: |
|
|
if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then
|
|
echo "provider=github" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "provider=gitea" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
release:
|
|
needs: prepare
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Run provider workflow
|
|
uses: ./.github/workflows/providers/${{ needs.prepare.outputs.provider == 'github' && 'github' || 'gitea' }}-release.yml
|
|
with:
|
|
version: ${{ needs.prepare.outputs.version }}
|
|
changelog: ${{ needs.prepare.outputs.changelog }}
|
|
secrets: inherit |