Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/weekly-psl-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Weekly PSL Update and Patch Release

on:
schedule:
# Run every Monday at 02:00 UTC
- cron: "0 2 * * 1"
workflow_dispatch:

jobs:
update-and-release:
name: Update PSL and Create Patch Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for cargo-release
ref: main # Always checkout main

- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"

- name: Check current PSL version
id: current-psl
run: |
echo "current_version=$(cargo tree -p psl | grep psl | head -1 | awk '{print $2}')" >> $GITHUB_OUTPUT

- name: Update PSL dependency
run: cargo update -p psl

- name: Check updated PSL version
id: updated-psl
run: |
echo "updated_version=$(cargo tree -p psl | grep psl | head -1 | awk '{print $2}')" >> $GITHUB_OUTPUT

- name: Determine if PSL was updated
id: psl-changed
run: |
if [ "${{ steps.current-psl.outputs.current_version }}" != "${{ steps.updated-psl.outputs.updated_version }}" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "PSL updated from ${{ steps.current-psl.outputs.current_version }} to ${{ steps.updated-psl.outputs.updated_version }}"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "PSL version unchanged: ${{ steps.current-psl.outputs.current_version }}"
fi

# use cargo-binstall
- uses: cargo-bins/cargo-binstall@main
if: steps.psl-changed.outputs.changed == 'true'

- name: Install cargo-release
if: steps.psl-changed.outputs.changed == 'true'
run: cargo binstall --verbose cargo-release

- name: Create patch release
if: steps.psl-changed.outputs.changed == 'true'
run: |
git commit -am "chore: upgrade psl ${{ steps.current-psl.outputs.current_version }}->${{ steps.updated-psl.outputs.updated_version }}"
cargo release patch --no-push --no-publish --execute --no-confirm -p pyfaup-rs
git push
git push --tags
echo "RELEASE_CREATED=true" >> $GITHUB_ENV

- name: Summary
run: |
echo "=== Weekly PSL Update Summary ==="
echo "Current PSL: ${{ steps.current-psl.outputs.current_version }}"
echo "Updated PSL: ${{ steps.updated-psl.outputs.updated_version }}"
echo "PSL Changed: ${{ steps.psl-changed.outputs.changed }}"
if [ "$RELEASE_CREATED" = "true" ]; then
echo "Release created"
echo "Tags pushed to GitHub"
else
echo "No release created (PSL unchanged and force-release not set)"
fi
Loading