Skip to content

Commit

Permalink
Merge pull request #248 from Loup-Garou911XD/main
Browse files Browse the repository at this point in the history
Added release workflow
  • Loading branch information
Loup-Garou911XD authored Apr 19, 2024
2 parents 7188f27 + 13177a9 commit 421e741
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create Release

on:
push:
tags:
- 'v1.*'

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
output=$(python3 test/get_changes.py "${{ github.ref }}")
echo "::set-output name=changelog::$output"
id: set_changelog
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
## Changelog
${{ steps.set_changelog.outputs.changelog }}
draft: false
prerelease: false\
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./plugin_manager.py
asset_name: plugin_manager.py
asset_content_type: application
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ which makes further modding of your game more convenient by providing easier acc
[![DownloadIcon]][DownloadLink]

[DownloadIcon]:https://img.shields.io/badge/Download-5555ff?style=for-the-badge&logoColor=white&logo=DocuSign
[DownloadLink]:https://cdn.jsdelivr.net/gh/bombsquad-community/plugin-manager/plugin_manager.py
[DownloadLinkJSdelivr]:https://cdn.jsdelivr.net/gh/bombsquad-community/plugin-manager/plugin_manager.py
[DownloadLink]:https://github.com/Loup-Garou911XD/plugin-manager/releases/latest/download/plugin_manager.py

![Plugin Manager GIF](https://user-images.githubusercontent.com/106954762/190505304-519c4b91-2461-42b1-be57-655a3fb0cbe8.gif)

Expand Down
24 changes: 24 additions & 0 deletions test/get_changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import re
import sys


def get_version_changelog(version):
with open('CHANGELOG.md', 'r') as file:
content = file.read()
pattern = rf"### {version} \(\d\d-\d\d-\d{{4}}\)\n(.*?)(?=### \d+\.\d+\.\d+|\Z)"
matches = re.findall(pattern, content, re.DOTALL)
if matches:
return matches[0].strip()
else:
return f"Changelog entry for version {version} not found."


if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python3 script.py version_number")
sys.exit(1)

version = sys.argv[1].replace("refs/tags/", "")
version = version.replace("v", "", 1)
changelog = get_version_changelog(version)
print(changelog)

0 comments on commit 421e741

Please sign in to comment.