-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate changelog and release packs for randomizer (#70)
- Loading branch information
Showing
11 changed files
with
160 additions
and
12 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,5 @@ | ||
<!-- | ||
If making a change in the Entrance Randomizer, remember to add a changelog entry. | ||
For for more information, read: | ||
https://github.com/Avasam/ptle-tools/blob/main/Dolphin%20scripts/Entrance%20Randomizer/CHANGELOG.md | ||
--> |
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,29 @@ | ||
import re | ||
import sys | ||
from os import listdir | ||
from pathlib import Path | ||
|
||
NEWS_TYPES = ("feature", "bugfix", "doc", "removal", "misc") | ||
|
||
NEWS_PATTERN = re.compile(r"(\d+|\+.+)\.(" + "|".join(NEWS_TYPES) + r")\.md") | ||
|
||
NEWSFRAGMENTS_FIR = Path(__file__).parent.parent / "Dolphin scripts" / \ | ||
"Entrance Randomizer" / "newsfragments" | ||
|
||
|
||
def main(): | ||
invalid_filenames = [ | ||
filename for filename | ||
in listdir(NEWSFRAGMENTS_FIR) | ||
if not NEWS_PATTERN.fullmatch(filename) | ||
] | ||
|
||
if invalid_filenames: | ||
sys.exit( | ||
"The following newsfragments don't match the " | ||
+ f"{NEWS_PATTERN} pattern: {invalid_filenames}", | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,46 @@ | ||
name: Pack Randomizer (Release) | ||
|
||
on: | ||
workflow_dispatch: # Allows manual triggers | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
# Release trigger | ||
- "Dolphin scripts/Entrance Randomizer/CHANGELOG.md" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
# Release tooling | ||
- "Dolphin scripts/pack-rando.ps1" | ||
- ".github/workflows/pack-randomizer-release.yaml" | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
pack-randomizer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: '& "Dolphin scripts/pack-rando.ps1" -Release' | ||
shell: pwsh | ||
# upload-artifact will double zip, so unpack first | ||
# https://github.com/actions/upload-artifact/issues/39 | ||
- name: Get pack filename | ||
id: packname | ||
run: | | ||
echo "packname=$( | ||
find -name 'Entrance Randomizer v*.zip' | sed 's/\.zip$//1' | sed 's/^\.\///1' | ||
)" >> $GITHUB_OUTPUT | ||
- name: Extract premade archive | ||
run: | | ||
7z x \ | ||
'${{ steps.packname.outputs.packname }}.zip' \ | ||
-o'${{ steps.packname.outputs.packname }}' | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.packname.outputs.packname }} | ||
path: ${{ steps.packname.outputs.packname }}/* |
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
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,22 @@ | ||
# Changelog | ||
|
||
All notable changes to the Entrance Randomizer will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The version semantics are inspired by [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and go as follow: | ||
|
||
```txt | ||
Major.Minor.Patch | ||
Major: New major feature or functionality (stays 0 until the first "stable" release) | ||
Minor: Affects seed | ||
Patch: Does't affect seed (assuming same settings) | ||
``` | ||
|
||
This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the changes for the upcoming release can be found in <https://github.com/Avasam/ptle-tools/blob/main/Dolphin%20scripts/Entrance%20Randomizer/newsfragments>. | ||
|
||
To add a changelog entry, add a new file `<issue_or_pr_#>.<type>.md` to the `newsfragments` folder. | ||
(See the different [fragment types](https://towncrier.readthedocs.io/en/latest/tutorial.html#creating-news-fragments)) | ||
|
||
<!-- towncrier release notes start --> | ||
|
||
## 5.0.0 - 2024-07-13 |
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
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 @@ | ||
Initialized the changelog using Towncrier -- by @Avasam |
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
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
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,8 @@ | ||
$RandoFolderName = 'Entrance Randomizer' | ||
$VersionFilePath = "$PSScriptRoot\$RandoFolderName/lib/constants.py" | ||
|
||
$RandoVersion = Read-Host 'Version number (X.X.X)' | ||
$VersionFileContent = Get-Content $VersionFilePath | ||
$VersionFileContent -replace '^\s*__version = .*', "__version = `"$RandoVersion`"" | Set-Content $VersionFilePath | ||
|
||
towncrier build --draft --version $RandoVersion |
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