81 lines
2.2 KiB
YAML
81 lines
2.2 KiB
YAML
name: Sync Versions
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Cargo.toml'
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Cargo.toml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
sync-versions:
|
|
name: Sync package.json versions with Cargo.toml
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install jq
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y jq
|
|
|
|
- name: Make scripts executable
|
|
run: chmod +x scripts/sync-versions.sh
|
|
|
|
- name: Sync versions
|
|
run: ./scripts/sync-versions.sh
|
|
|
|
- name: Check for changes
|
|
id: changes
|
|
run: |
|
|
if git diff --quiet; then
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
echo "No version changes detected"
|
|
else
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
echo "Version changes detected"
|
|
git diff --name-only
|
|
fi
|
|
|
|
- name: Commit and push changes
|
|
if: steps.changes.outputs.changed == 'true' && github.event_name == 'push'
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git add oauth/package.json pds/package.json
|
|
git commit -m "🔄 Sync package.json versions with Cargo.toml"
|
|
git push
|
|
|
|
- name: Create Pull Request
|
|
if: steps.changes.outputs.changed == 'true' && github.event_name == 'pull_request'
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: "🔄 Sync package.json versions with Cargo.toml"
|
|
title: "Auto-sync package.json versions"
|
|
body: |
|
|
This PR automatically syncs package.json versions with the version in Cargo.toml.
|
|
|
|
Changes:
|
|
- Updated oauth/package.json version
|
|
- Updated pds/package.json version
|
|
|
|
Generated by GitHub Actions.
|
|
branch: sync-versions-${{ github.run_number }}
|
|
delete-branch: true |