Skip to content

PG-2237 - Automate release date for Release Notes #2

PG-2237 - Automate release date for Release Notes

PG-2237 - Automate release date for Release Notes #2

name: Release Docs Automation
on:
pull_request:
paths:
- docs/release-notes/**
- variables.yml
push:
branches:
- '1*'
paths:
- docs/release-notes/**
- variables.yml
jobs:
build:
name: Update release metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update release date
run: |
TODAY=$(date +'%Y-%m-%d')
VERSION=$(grep "pspgversion:" variables.yml | awk '{print $2}' | tr -d "'")
KEY=$(echo $VERSION | tr '.' '_')
echo "Setting release date for version $VERSION ($KEY)"
if grep -q "$KEY:" variables.yml; then
sed -i "s/$KEY:.*/$KEY: $TODAY/" variables.yml
else
sed -i "/date:/a\ $KEY: $TODAY" variables.yml
fi
- name: Show changes
run: git diff
- name: Commit changes
if: startsWith(github.ref, 'refs/heads/1')
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add variables.yml
git diff --cached --quiet || git commit -m "Auto-update release date"
git push