Page-mode Demo #22
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: Update Velt Versions | |
| on: | |
| # Trigger when velt-versions.json is modified | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'velt-versions.json' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: 'Run mode' | |
| required: true | |
| default: 'update' | |
| type: choice | |
| options: | |
| - update | |
| - check | |
| - dry-run | |
| # Run on PRs to check if versions are in sync | |
| pull_request: | |
| paths: | |
| - 'velt-versions.json' | |
| - '**/package.json' | |
| jobs: | |
| update-versions: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Determine run mode | |
| id: mode | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| echo "mode=check" >> $GITHUB_OUTPUT | |
| elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "mode=${{ inputs.mode }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "mode=update" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Run version check (PR) | |
| if: steps.mode.outputs.mode == 'check' | |
| run: node scripts/update-velt-versions.js --check | |
| - name: Run version update (dry-run) | |
| if: steps.mode.outputs.mode == 'dry-run' | |
| run: node scripts/update-velt-versions.js --dry-run | |
| - name: Run version update | |
| if: steps.mode.outputs.mode == 'update' | |
| run: | | |
| node scripts/update-velt-versions.js | |
| # Check if there are changes | |
| if git diff --quiet; then | |
| echo "No version changes needed" | |
| exit 0 | |
| fi | |
| # Install dependencies to update lockfile | |
| pnpm install --no-frozen-lockfile | |
| - name: Commit and push changes | |
| if: steps.mode.outputs.mode == 'update' && github.event_name == 'push' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add -A | |
| if ! git diff --staged --quiet; then | |
| git commit -m "chore: update Velt package versions [skip ci]" | |
| git push | |
| fi | |
| - name: Create Pull Request (manual trigger) | |
| if: steps.mode.outputs.mode == 'update' && github.event_name == 'workflow_dispatch' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: 'chore: update Velt package versions' | |
| title: 'chore: Update Velt package versions' | |
| body: | | |
| This PR updates Velt package versions across all sample apps. | |
| Changes were generated by the `update-velt-versions` workflow based on `velt-versions.json`. | |
| Please review the changes and merge if everything looks correct. | |
| branch: chore/update-velt-versions | |
| delete-branch: true |