diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000..d7d0ce2 --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,49 @@ +name: Create Release + +on: + push: + branches: [main] + +jobs: + create_release: + if: startsWith(github.event.head_commit.message, 'new version') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract version from commit message + run: | + # Get the version from the commit message using a regex + if [[ "${{ github.event.head_commit.message }}" =~ new\ version\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then + echo "version=${BASH_REMATCH[1]}" >> $GITHUB_ENV + else + echo "Commit message does not match 'new version *.*.*' format." + exit 1 + fi + + - name: Get previous tag + run: | + previous_tag=$(git describe --tags --abbrev=0 HEAD^) + echo "previous_tag=$previous_tag" >> $GITHUB_ENV + + - name: Generate release notes with commit messages + run: | + commits=$(git log "${{ env.previous_tag }}..HEAD" --oneline) + echo "release_body<> $GITHUB_ENV + echo "### Changelog from version ${{ env.previous_tag }} to ${{ env.version }}:" >> $GITHUB_ENV + echo "$commits" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Create GitHub release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.YASMIN_GITHUB_TOKEN }} + with: + tag_name: "${{ env.version }}" + release_name: "${{ env.version }}" + body: "${{ env.release_body }}" + draft: false + prerelease: false diff --git a/.github/workflows/doxygen-deployment.yml b/.github/workflows/doxygen-deployment.yml index 6613bc0..2b9e910 100644 --- a/.github/workflows/doxygen-deployment.yml +++ b/.github/workflows/doxygen-deployment.yml @@ -25,6 +25,6 @@ jobs: - name: Deploy Doxygen page uses: peaceiris/actions-gh-pages@v4 with: - github_token: ${{ secrets.DOXYGEN_DEPLOY_TOKEN }} + github_token: ${{ secrets.YASMIN_GITHUB_TOKEN }} publish_branch: gh-pages publish_dir: docs