move to github release drafter #425
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Draft Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| draft_release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from manifest | |
| id: version | |
| run: | | |
| version=$(jq -r .version custom_components/victron_mqtt/manifest.json) | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Create or update draft release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tag="v${{ steps.version.outputs.version }}" | |
| # Check if a draft release already exists for this tag | |
| existing=$(gh release list --json tagName,isDraft -q ".[] | select(.tagName == \"$tag\" and .isDraft) | .tagName") | |
| if [ -n "$existing" ]; then | |
| gh release edit "$tag" --draft --generate-notes | |
| else | |
| gh release create "$tag" --draft --generate-notes --title "$tag" | |
| fi |