Use a custom bot personal access token (#1930) (#1934)

This bot has owner access to the repo and should be able to push changes to protected branches, as long as the workflows are being ran from trusted branches / remotes.

Also extract changelog and use it for the draft.
This commit is contained in:
Mayur Pawashe authored and GitHub committed 2021-09-02 23:54:20 -07:00
1 parent 8f7fad4d3a
commit b5755d41cb
2 files changed
+38 -5

No files matched your search

+15 -5
View File
@@ -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
+23
View File
@@ -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)