Update release changelogs #4
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
name: Update release changelogs | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
- edited | |
jobs: | |
run-on-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Updating release-stable.json | |
run: | | |
# Fetch the latest release data from the GitHub API | |
RELEASE_DATA=$(curl -s "https://api.github.com/repos/hedon-haven/viewer/releases/latest") | |
# Extract "tag_name" and "body" fields | |
VERSION=$(echo "$RELEASE_DATA" | jq -r '.tag_name') | |
CHANGELOG=$(echo "$RELEASE_DATA" | jq -r '.body') | |
# Create changelog | |
echo $CHANGELOG > release-changelogs/$VERSION | |
# link latest to it | |
cd release-changelogs | |
rm latest | |
ln -s $VERSION latest | |
# Commit and push changes | |
- name: Committing changes to repo | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Update latest changelog" | |
default_author: github_actions |