diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml index 1fb20e15..e0e96827 100644 --- a/.github/workflows/create-draft-release.yml +++ b/.github/workflows/create-draft-release.yml @@ -20,8 +20,13 @@ jobs: - name: "Checkout sources" uses: actions/checkout@v2 with: + token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} submodules: true fetch-depth: 0 + + - name: "Extract latest changes from CHANGELOG" + run: | + ./Configurations/generate_latest_changes.py > latest-changes.txt - name: "Extract version information from project" run: | @@ -37,19 +42,22 @@ jobs: echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV fi - - name: "Create a temporary Git tag" - run: git tag "${{ env.MARKETING_VERSION }}" + - name: "Set up git and create tag" + run: | + git config user.name Sparkle-Bot + git config user.email sparkle.project.bot@gmail.com + git tag "${{ env.MARKETING_VERSION }}" - name: "Build release distribution" run: make release env: GITHUB_ACTOR: ${{ github.actor }} GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MARKETING_VERSION: ${{ env.MARKETING_VERSION }} - SPARKLE_VERSION_SUFFIX: ${{ env.SPARKLE_VERSION_SUFFIX }} + GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} - name: "Push the updated Swift package description" + env: + GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} run: git push - name: "Draft a release" @@ -60,6 +68,8 @@ jobs: name: "Sparkle ${{ env.MARKETING_VERSION }}" tag_name: ${{ env.MARKETING_VERSION }} fail_on_unmatched_files: true + token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} + body_path: latest-changes.txt files: | build/Build/Products/Release/Sparkle-*.tar.xz build/Build/Products/Release/Sparkle-for-Swift-Package-Manager.zip diff --git a/Configurations/generate_latest_changes.py b/Configurations/generate_latest_changes.py new file mode 100755 index 00000000..e3da05cd --- /dev/null +++ b/Configurations/generate_latest_changes.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import os, sys + +# Ignore the first version line starting with # x.y.z.. +# and print everything until the second version line starting with # x.y.z.. + +hit_first_changelog_note = False +with open("CHANGELOG", "r") as changelog_file: + for line in changelog_file: + if line.startswith("#"): + if hit_first_changelog_note: + # We are done with printing changes + break + else: + # We haven't hit an important changelog line yet, so continue + continue + + if not hit_first_changelog_note and len(line.strip()) == 0: + continue + + hit_first_changelog_note = True + sys.stdout.write(line)