Skip to content

feat: add check results function to audio projects #92

feat: add check results function to audio projects

feat: add check results function to audio projects #92

Workflow file for this run

name: Create Release
on:
pull_request:
types: [closed]
branches:
- main
jobs:
check-and-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate a token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: 1057549 # https://github.com/organizations/magichourhq/settings/apps/magic-hour-sdk-bot
private-key: ${{ secrets.SDK_GENERATOR_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check if pyproject.toml version changed
id: check_version
run: |
git fetch origin ${{ github.base_ref }}
OLD_VERSION=$(git show HEAD~1:pyproject.toml | grep -m 1 '^version = ' | cut -d '"' -f 2)
NEW_VERSION=$(grep -m 1 '^version = ' pyproject.toml | cut -d '"' -f 2)
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: steps.check_version.outputs.version_changed == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.check_version.outputs.new_version }}
name: v${{ steps.check_version.outputs.new_version }}
generate_release_notes: true
draft: false
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}