Compare commits

..

2 Commits

Author SHA1 Message Date
abdelrahman 23613d16b7 Update release workflow
Release / release (push) Successful in 4s
2026-08-30 14:20:47 +01:00
abdelrahman 8cd1d56b4a Save extracted changelog in workspace 2026-08-30 14:20:40 +01:00
2 changed files with 18 additions and 20 deletions
+12 -13
View File
@@ -45,7 +45,7 @@ jobs:
exit 1 exit 1
fi fi
echo "changelog=$(cat $CHANGELOG_FILE)" >> $GITHUB_OUTPUT echo "changelog_file=$CHANGELOG_FILE" >> $GITHUB_OUTPUT
- name: Build Artifacts - name: Build Artifacts
if: steps.tag.outputs.version if: steps.tag.outputs.version
@@ -59,18 +59,17 @@ jobs:
id: create_release id: create_release
run: | run: |
VERSION="${{ steps.tag.outputs.version }}" VERSION="${{ steps.tag.outputs.version }}"
CHANGELOG="${{ steps.changelog.outputs.changelog }}" CHANGELOG_FILE="${{ steps.changelog.outputs.changelog_file }}"
RESPONSE=$(curl -s -X POST \ RESPONSE=$(jq -n \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ --arg tag "v$VERSION" \
-H "Content-Type: application/json" \ --arg name "wapp-v$VERSION" \
"https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases" \ --rawfile body "$CHANGELOG_FILE" \
-d '{ '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}' \
"tag_name": "v'"$VERSION"'", | curl -s -X POST \
"name": "wapp-v'"$VERSION"'", -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"body": "'"$CHANGELOG"'", -H "Content-Type: application/json" \
"draft": false, --data-binary @- \
"prerelease": false "https://git.thewizardapprentice.com/api/v1/repos/${{ gitea.repository }}/releases")
}')
echo "$RESPONSE" echo "$RESPONSE"
RELEASE_ID=$(echo $RESPONSE | jq -r '.id') RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
+6 -7
View File
@@ -2,9 +2,9 @@ import os
import re import re
import argparse import argparse
from pathlib import Path from pathlib import Path
from tempfile import mkstemp
VERSION_HEADER = re.compile(r"\[\d+.\d+.\d+\]") VERSION_HEADER = re.compile(r"\[\d+.\d+.\d+\]")
SCRIPT_DIR = Path(__file__).absolute().parent.parent
def main(): def main():
@@ -19,8 +19,7 @@ def main():
def get_changelog(version: str) -> list[str]: def get_changelog(version: str) -> list[str]:
script_dir = Path(__file__).absolute().parent.parent changelog = SCRIPT_DIR / "CHANGELOG.md"
changelog = script_dir / "CHANGELOG.md"
with changelog.open("r") as infile: with changelog.open("r") as infile:
lines = infile.readlines() lines = infile.readlines()
@@ -47,10 +46,10 @@ def get_changelog(version: str) -> list[str]:
def save_changelog(version: str, lines: list[str]) -> str: def save_changelog(version: str, lines: list[str]) -> str:
fd, name = mkstemp(prefix=f"wapp-changelog-{version}-", text=True) version_changelog = SCRIPT_DIR / f"wapp-changelog-{version}.md"
os.write(fd, "".join(lines).encode("utf-8")) with version_changelog.open("w") as outfile:
os.close(fd) outfile.writelines(lines)
return name return str(version_changelog)
if __name__ == "__main__": if __name__ == "__main__":