PG-2237 - Automate release date for Release Notes #2
This file contains hidden or 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: 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 |