-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Prescod
committed
Feb 17, 2023
1 parent
b5fe2d6
commit 4649506
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Update Python Dependencies | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
update_dependencies: | ||
runs-on: sfdc-ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
id: py | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: pip | ||
cache-dependency-path: "requirements/*.txt" | ||
- name: Update dependencies | ||
run: | | ||
pip install pip-tools | ||
make update-deps | ||
- name: Commit dependency changes and open PR | ||
run: | | ||
export DAY="$(date -I)" | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git switch prerelease || git switch -c prerelease | ||
git add requirements/*.txt | ||
git commit -m "$DAY dependency updates (automated)" || true | ||
git push | ||
- name: Generate release notes | ||
id: changelog | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
export DAY="$(date -I)" | ||
PREVIOUS_VERSION=$(gh release view --json tagName --jq .tagName) | ||
NEXT_VERSION="v$(head -n 1 snowfakery/version.txt)" | ||
echo "## $NEXT_VERSION ($(date -I))" > changelog.md | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
/repos/SFDO-Tooling/CumulusCI/releases/generate-notes \ | ||
-f previous_tag_name=$PREVIOUS_VERSION \ | ||
-f target_commitish='main' \ | ||
-f tag_name=$NEXT_VERSION \ | ||
--jq '.body' | \ | ||
sed -e 's_\(https.*\/\)\([0-9]*\)$_[#\2](\1\2)_' \ | ||
-e 's_by @\(.*\) in_by [@\1](https://github.com/\1) in_' >> changelog.md | ||
python utility/update-history.py | ||
git commit -m "$DAY history updates" || true | ||
git push | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh pr view || gh pr create --fill --label 'auto-pr,dependencies' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Todo: move tools/* into utility/* to match CCI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
Update the history file. | ||
""" | ||
from pathlib import Path | ||
import re | ||
|
||
START_MARKER = "<!-- latest-start -->" | ||
STOP_MARKER = "<!-- latest-stop -->" | ||
|
||
history = Path("HISTORY.md").read_text() | ||
latest = Path("changelog.md").read_text() | ||
print(re.findall(f"{START_MARKER}.*", history, flags=re.DOTALL)) | ||
updated = re.sub( | ||
f"{START_MARKER}.*{STOP_MARKER}", | ||
f"{START_MARKER}\n{latest}\n{STOP_MARKER}", | ||
history, | ||
flags=re.DOTALL, | ||
) | ||
|
||
Path("HISTORY.md").write_text(updated) |