mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-23 10:08:08 +00:00
Improve Release-Action (awk function) (#2934)
This commit is contained in:
parent
b0a06bdc5f
commit
89962b01fa
25
.github/workflows/github-release.yml
vendored
25
.github/workflows/github-release.yml
vendored
@ -4,7 +4,7 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '1 0 * * *' # Runs daily at 00:01 UTC
|
- cron: '1 0 * * *' # Runs daily at 00:01 UTC
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-daily-release:
|
create-daily-release:
|
||||||
runs-on: runner-cluster-htl-set
|
runs-on: runner-cluster-htl-set
|
||||||
@ -14,32 +14,25 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract first 5000 characters from CHANGELOG.md
|
- name: Clean CHANGELOG (remove HTML header)
|
||||||
run: head -c 5000 CHANGELOG.md > changelog_cropped.md
|
run: sed -n '/^## /,$p' CHANGELOG.md > changelog_cleaned.md
|
||||||
|
|
||||||
- name: Debugging - Show extracted changelog
|
|
||||||
run: |
|
|
||||||
echo "=== CHANGELOG EXCERPT ==="
|
|
||||||
cat changelog_cropped.md
|
|
||||||
echo "========================="
|
|
||||||
|
|
||||||
- name: Extract relevant changelog section
|
- name: Extract relevant changelog section
|
||||||
run: |
|
run: |
|
||||||
YESTERDAY=$(date -u --date="yesterday" +%Y-%m-%d)
|
YESTERDAY=$(date -u --date="yesterday" +%Y-%m-%d)
|
||||||
echo "Checking for changes on: $YESTERDAY"
|
echo "Checking for changes on: $YESTERDAY"
|
||||||
|
|
||||||
# Extract relevant section from cropped changelog
|
# Extract the section from "## $YESTERDAY" until the next "## YYYY-MM-DD"
|
||||||
awk -v date="## $YESTERDAY" '
|
sed -n "/^## $YESTERDAY/,/^## [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/p" changelog_cleaned.md | head -n -1 > changelog_tmp_full.md
|
||||||
$0 ~ date {found=1; next}
|
|
||||||
found && /^## [0-9]{4}-[0-9]{2}-[0-9]{2}/ {exit}
|
# Truncate the extracted section to 5000 characters
|
||||||
found
|
head -c 5000 changelog_tmp_full.md > changelog_tmp.md
|
||||||
' changelog_cropped.md > changelog_tmp.md
|
|
||||||
|
|
||||||
echo "=== Extracted Changelog ==="
|
echo "=== Extracted Changelog ==="
|
||||||
cat changelog_tmp.md
|
cat changelog_tmp.md
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
|
|
||||||
# Skip if no content was found
|
# Abort if no content was found
|
||||||
if [ ! -s changelog_tmp.md ]; then
|
if [ ! -s changelog_tmp.md ]; then
|
||||||
echo "No changes found for $YESTERDAY, skipping release."
|
echo "No changes found for $YESTERDAY, skipping release."
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user