fix cargo version gh-actions

This commit is contained in:
2025-08-09 18:13:27 +09:00
parent 824aee7b74
commit 0dc2b854c9
8 changed files with 259 additions and 7 deletions

View File

@@ -48,6 +48,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js for version sync
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install jq
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
sudo apt-get update && sudo apt-get install -y jq
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
brew install jq
fi
- name: Sync package.json versions
run: |
chmod +x scripts/sync-versions.sh
./scripts/sync-versions.sh
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:

81
.github/workflows/sync-versions.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
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