Merge branch 'main' into compiler-improvement/remove-trailing-whitespace

This commit is contained in:
Mr.k 2024-08-01 22:34:09 +03:00
commit 6527756c39
No known key found for this signature in database
2 changed files with 20 additions and 8 deletions

View File

@ -3,7 +3,12 @@ name: Update changelog.md on Release
on: on:
release: release:
types: [published, created, edited, deleted] types: [published, created, edited, deleted]
workflow_dispatch: # Add this line to enable manual triggering workflow_dispatch:
inputs:
reason:
description: 'Reason for manual trigger'
required: false
default: 'Manual update'
jobs: jobs:
update-file: update-file:
@ -18,7 +23,7 @@ jobs:
# Initialize some values # Initialize some values
changelog_path="docs/changelog.md" changelog_path="docs/changelog.md"
gh release list --exclude-drafts --json tagName,name,isLatest,isPrerelease --limit 1000000 > releases.txt gh release list --exclude-drafts --json tagName,name,isLatest,isPrerelease --limit 1000000 > releases.txt
declare -rA number_of_releases=$(cat releases.txt | grep -Po '"tagName"' | wc --lines) declare -r number_of_releases=$(cat releases.txt | grep -Po '"tagName"' | wc --lines)
# Clear the contents of changelog file # Clear the contents of changelog file
echo "" > $changelog_path echo "" > $changelog_path
@ -91,7 +96,7 @@ jobs:
name=${name_arr[$i]} name=${name_arr[$i]}
isprerelease=${isprerelease_arr[$i]} isprerelease=${isprerelease_arr[$i]}
islatest=${islatest_arr[$i]} islatest=${islatest_arr[$i]}
body=$(gh release view "$tag" --json body --jq .body) body=$(gh release view "$tag" --json body --jq .body) || { echo "Failed to fetch release body for $tag"; exit 1; }
# The generation of changelog file contents # The generation of changelog file contents
echo "# $name" >> $changelog_path echo "# $name" >> $changelog_path
@ -109,5 +114,4 @@ jobs:
git config --global user.name 'github-actions[bot]' git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com' git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/changelog.md git add docs/changelog.md
git commit -m "Update changelog.md with all releases" git diff --quiet && git diff --staged --quiet || (git commit -m "Update changelog.md with all releases" && git push)
git push

View File

@ -14,11 +14,11 @@ jobs:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Extract Version from winutil.ps1 - name: Set Version to Todays Date
id: extract_version id: extract_version
run: | run: |
$version = (Get-Date -Format "yy.MM.dd") $version = (Get-Date -Format "yy.MM.dd")
echo "version=$version" >> $env:GITHUB_ENV echo "VERSION=$version" >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
- name: Create Tag - name: Create Tag
@ -27,7 +27,15 @@ jobs:
$tagExists = git tag -l $env:VERSION $tagExists = git tag -l $env:VERSION
if ($tagExists -eq "") { if ($tagExists -eq "") {
git tag $env:VERSION git tag $env:VERSION
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to create tag $env:VERSION"
exit 1
}
git push origin $env:VERSION git push origin $env:VERSION
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to push tag $env:VERSION"
exit 1
}
} else { } else {
Write-Host "Tag $env:VERSION already exists, skipping tag creation" Write-Host "Tag $env:VERSION already exists, skipping tag creation"
} }