Skip to content

Commit fe420bb

Browse files
committed
Generate the changelog for the beta releases
1 parent 7e512dc commit fe420bb

4 files changed

Lines changed: 100 additions & 21 deletions

File tree

.github/release-drafter.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name-template: Beta Release
2+
tag-template: beta
3+
category-template: "### $TITLE"
4+
exclude-labels:
5+
- technical
6+
- invalid
7+
- duplicate
8+
categories:
9+
- title: New to Path of Building
10+
labels:
11+
- enhancement
12+
- title: Fixed Crashes
13+
labels:
14+
- crash
15+
- title: User Interface
16+
labels:
17+
- user-interface
18+
- title: Fixed Calculations
19+
labels:
20+
- "bug: calculation"
21+
- title: Fixed Behaviours
22+
labels:
23+
- "bug: behaviour"
24+
- title: Accuracy Improvements
25+
labels:
26+
- "bug: accuracy"
27+
- title: Fixed Bugs
28+
labels:
29+
- bug
30+
- title: Other changes
31+
change-template: "* $TITLE by @$AUTHOR in https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/pull/$NUMBER"
32+
template: |
33+
## What’s Changed
34+
35+
$CHANGES
36+
37+
**Full Changelog**: https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/compare/$PREVIOUS_TAG...beta

.github/tweak_changelogs.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
RELEASE_VERSION="$1"
4+
5+
# Delete until the first line containing "--"
6+
sed -i '1,/--/d' temp_change.md
7+
# Reverse the order of lines in the file (last line becomes first, etc.)
8+
sed -i '1h;1d;$!H;$!d;G' temp_change.md
9+
# Convert "**Full Changelog**: URL" format to markdown link format "[Full Changelog](URL)"
10+
sed -i -re 's/\*\*Full Changelog\*\*: (.*)/\[Full Changelog\]\(\1\)\n/' temp_change.md
11+
# Delete everything from "## New Contributors" line to the end of file
12+
sed -i '/## New Contributors/,$d' temp_change.md
13+
# Convert GitHub changelog entries from "* description by @username in pull/URL/number"
14+
# to "- description [#number](pull/URL/number) ([username](https://github.com/username))" format
15+
sed -i -re 's/^\*(.*)\sby\s@(.*)\sin\s(.*\/pull\/)(.*)/-\1 [\\#\4](\3\4) ([\2](https:\/\/github.com\/\2))/' temp_change.md
16+
# Username substitutions for preferred display names
17+
sed -i 's/\[Quotae/\[Quote_a/' temp_change.md
18+
sed -i 's/\[learn2draw/\[Lexy/' temp_change.md
19+
sed -i 's/\[Voronoff/\[Tom Clancy Is Dead/' temp_change.md
20+
sed -i 's/\[PJacek/\[TPlant/' temp_change.md
21+
sed -i 's/\[justjuangui/\[trompetin17/' temp_change.md
22+
23+
cp temp_change.md changelog_temp.txt
24+
# Append existing CHANGELOG.md content (excluding first line) to temp_change.md
25+
sed '1d' CHANGELOG.md >> temp_change.md
26+
# Create new CHANGELOG.md with header containing version and date, followed by processed changes
27+
printf "# Changelog\n\n## [$RELEASE_VERSION](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/tree/$RELEASE_VERSION) ($(date +'%Y/%m/%d'))\n\n" | cat - temp_change.md > CHANGELOG.md
28+
# Convert changelog entries from markdown link format to simplified "* description (username)" format
29+
sed -i -re 's/^- (.*) \[.*\) \(\[(.*)\]\(.*/* \1 (\2)/' changelog_temp.txt
30+
# Create new changelog format: add version header, remove lines 2-3, format section headers, remove ## headers with following line, prepend to existing changelog
31+
echo "VERSION[${RELEASE_VERSION#v}][$(date +'%Y/%m/%d')]" | cat - changelog_temp.txt | sed '2,3d' | sed -re 's/^### (.*)/\n--- \1 ---/' | sed -e '/^##.*/,+1 d' | cat - changelog.txt > changelog_new.txt
32+
mv changelog_new.txt changelog.txt
33+
34+
# Normalize line endings to CRLF for all output files to ensure consistent checksums with Windows
35+
sed 's/\r*$/\r/' CHANGELOG.md > CHANGELOG_normalized.md && mv CHANGELOG_normalized.md CHANGELOG.md
36+
sed 's/\r*$/\r/' changelog.txt > changelog_normalized.txt && mv changelog_normalized.txt changelog.txt
37+
38+
# Clean up temporary files
39+
rm temp_change.md
40+
rm changelog_temp.txt

.github/workflows/beta.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ jobs:
2020
run: |
2121
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
2222
git config --global user.name "github-actions[bot]"
23+
# The hash suffix will help identifying if the beta version is up-to-date
24+
- name: Add commit hash suffix to manifest version
25+
run: |
26+
sed -i "s/<Version number=\"\([^\"]*\)\"/<Version number=\"\1-$(git rev-parse --short HEAD)\"/g" manifest.xml
27+
# Release drafter will create (or update) a draft release with the generated changelogs based on ../release-drafter.yml
28+
- uses: release-drafter/release-drafter@v5
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Generate Release notes
32+
run: >
33+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token;
34+
gh release view beta | tee temp_change.md
35+
- name: Tweak changelogs
36+
run: |
37+
# Remove carriage returns to be able to run the script
38+
sed -i 's/\r$//' .github/tweak_changelogs.sh
39+
chmod +x .github/tweak_changelogs.sh
40+
.github/tweak_changelogs.sh beta
2341
- name: Update manifest.xml
2442
run: python3 update_manifest.py --quiet --in-place
2543
- name: Push to beta branch

.github/workflows/release.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,11 @@ jobs:
2929
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token;
3030
gh release view $(basename ${{ github.event.inputs.releaseNoteUrl }}) > temp_change.md
3131
- name: Tweak changelogs
32-
run: >
33-
sed -i '1,10d' temp_change.md;
34-
sed -i '1h;1d;$!H;$!d;G' temp_change.md;
35-
sed -i -re 's/\*\*Full Changelog\*\*: (.*)/\[Full Changelog\]\(\1\)\n/' temp_change.md;
36-
sed -i '/## New Contributors/,$d' temp_change.md;
37-
sed -i -re 's/^\*(.*)\sby\s@(.*)\sin\s(.*\/pull\/)(.*)\r?/-\1 [\\#\4](\3\4) ([\2](https:\/\/github.com\/\2))/' temp_change.md;
38-
sed -i 's/\[Quotae/\[Quote_a/' temp_change.md;
39-
sed -i 's/\[learn2draw/\[Lexy/' temp_change.md;
40-
sed -i 's/\[Voronoff/\[Tom Clancy Is Dead/' temp_change.md;
41-
sed -i 's/\[PJacek/\[TPlant/' temp_change.md;
42-
sed -i 's/\[justjuangui/\[trompetin17/' temp_change.md;
43-
sed -i 's/\r//g' temp_change.md;
44-
cp temp_change.md changelog_temp.txt;
45-
cat CHANGELOG.md | tr \\r \\n | sed '1d' >> temp_change.md;
46-
printf "# Changelog\n\n## [v${{ github.event.inputs.releaseVersion }}](https://github.com/PathOfBuildingCommunity/PathOfBuilding/tree/v${{ github.event.inputs.releaseVersion }}) ($(date +'%Y/%m/%d'))\n\n" | cat - temp_change.md > CHANGELOG.md;
47-
48-
sed -i -re 's/^- (.*) \[.*\) \(\[(.*)\]\(.*/* \1 (\2)/' changelog_temp.txt;
49-
echo "VERSION[${{ github.event.inputs.releaseVersion }}][`date +'%Y/%m/%d'`]" | cat - changelog_temp.txt | tr -d \\r | sed '2,3d' | sed -re 's/^### (.*)/\n--- \1 ---/' | sed -e '/^##.*/,+1 d' | cat - changelog.txt > changelog_new.txt;
50-
rm temp_change.md;
51-
rm changelog_temp.txt;
52-
mv changelog_new.txt changelog.txt
32+
run: |
33+
# Remove carriage returns to be able to run the script
34+
sed -i 's/\r$//' .github/tweak_changelogs.sh
35+
chmod +x .github/tweak_changelogs.sh
36+
.github/tweak_changelogs.sh "v${{ github.event.inputs.releaseVersion }}"
5337
- name: Create Pull Request
5438
uses: peter-evans/create-pull-request@v5
5539
with:

0 commit comments

Comments
 (0)