This commit is contained in:
2025-08-09 18:30:10 +09:00
parent 46404ee1c7
commit 9c7556bca0
6 changed files with 40 additions and 380 deletions

View File

@@ -1,61 +0,0 @@
name: Pre-release Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-build:
name: Test Build and Version Sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Test version sync
run: |
chmod +x scripts/sync-versions.sh
./scripts/sync-versions.sh
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Test build
run: cargo build --release
- name: Test version consistency
run: |
CARGO_VERSION=$(grep '^version = ' Cargo.toml | cut -d'"' -f2)
OAUTH_VERSION=$(jq -r '.version' oauth/package.json)
PDS_VERSION=$(jq -r '.version' pds/package.json)
echo "Cargo.toml: $CARGO_VERSION"
echo "oauth/package.json: $OAUTH_VERSION"
echo "pds/package.json: $PDS_VERSION"
if [[ "$CARGO_VERSION" != "$OAUTH_VERSION" ]] || [[ "$CARGO_VERSION" != "$PDS_VERSION" ]]; then
echo "❌ Version mismatch detected!"
exit 1
else
echo "✅ All versions are synchronized"
fi

View File

@@ -48,28 +48,6 @@ 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
continue-on-error: true
run: |
echo "🔄 Trying Node.js version sync first..."
node scripts/sync-versions.js || {
echo "🔄 Node.js version failed, trying shell script..."
chmod +x scripts/sync-versions.sh
./scripts/sync-versions.sh || echo "⚠️ Both version sync methods failed, but continuing with build..."
}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

View File

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