Skip to content

Create Tag & Release #29

Create Tag & Release

Create Tag & Release #29

name: Create Tag & Release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
tag-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Necessary for scripts to access all tags and .github/release.yml
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip install PyYAML
- name: Calculate next tag
id: next-tag
run: echo "tag=$(python .github/scripts/calculate_next_tag.py)" >> $GITHUB_OUTPUT
shell: bash
# - name: Generate release notes
# id: generate-notes
# run: |
# NOTES=$(python .github/scripts/generate_release_notes.py)
# NOTES="${NOTES//'%'/'%25'}"
# NOTES="${NOTES//$'\n'/'%0A'}"
# NOTES="${NOTES//$'\r'/'%0D'}"
# echo "::set-output name=notes::$NOTES"
# - name: Generate release notes v1
# id: generate-notes-v1
# run: |
# NOTES=$(python .github/scripts/generate_release_notes.py)
# NOTES="${NOTES//'%'/'%25'}"
# NOTES="${NOTES//$'\n'/'%0A'}"
# NOTES="${NOTES//$'\r'/'%0D'}"
# echo "notes=$NOTES" >> $GITHUB_OUTPUT
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
# - name: Generate release notes v2
# id: generate-notes-v2
# run: |
# NOTES=$(python .github/scripts/generate_release_notes.py')
# # Split NOTES into an array of lines
# IFS=$'\n' read -d '' -r -a lines <<< "$NOTES"
# # Append each line individually
# for line in "${lines[@]}"; do
# echo "notes<<EOF" >> $GITHUB_OUTPUT
# echo "$line" >> $GITHUB_OUTPUT
# echo "EOF" >> $GITHUB_OUTPUT
# done
- name: Generate release notes and encode
id: generate-notes-v3
run: |
NOTES=$(python .github/scripts/generate_release_notes.py | base64)
echo "notes=$NOTES" >> $GITHUB_OUTPUT
# - name: Generate release notes
# id: generate-notes
# run: |
# echo "notes<<EOF" >> $GITHUB_OUTPUT
# python .github/scripts/generate_release_notes.py'
# echo "EOF" >> $GITHUB_OUTPUT
# https://github.com/seljabali/release-notes-generator/actions/runs/8857213252/job/24324425228
- name: Create the new tag
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ steps.next-tag.outputs.tag }}
git push origin ${{ steps.next-tag.outputs.tag }}
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
generate_release_notes: false
make_latest: true
tag_name: ${{ steps.next-tag.outputs.tag }}
name: ${{ steps.next-tag.outputs.tag }}
body: ${{ steps.generate-notes.outputs.notes }}