|
| 1 | +# vim: sw=2 |
| 2 | +name: Misc |
| 3 | + |
| 4 | +concurrency: |
| 5 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 6 | + cancel-in-progress: true |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [ "main" ] |
| 11 | + pull_request: |
| 12 | + branches: [ "main" ] |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + pull-requests: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + check-version-bump: |
| 20 | + name: Check version bump |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v5 |
| 25 | + - name: Check version bump |
| 26 | + id: version-check |
| 27 | + continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}} |
| 28 | + uses: silicon-heaven/rust-check-version-bump@v1.0.1 |
| 29 | + |
| 30 | + - name: Check if Cargo.lock was changed |
| 31 | + continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}} |
| 32 | + run: | |
| 33 | + cargo update --workspace |
| 34 | + if ! git diff --exit-code; then |
| 35 | + echo "Error: No version bump detected in Cargo.lock" |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | +
|
| 39 | + - name: Fetch Dependabot metadata |
| 40 | + id: dependabot-metadata |
| 41 | + if: steps.version-check.outcome == 'failure' |
| 42 | + uses: dependabot/fetch-metadata@v2 |
| 43 | + with: |
| 44 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 45 | + |
| 46 | + - name: Checkout code |
| 47 | + if: steps.version-check.outcome == 'failure' |
| 48 | + uses: actions/checkout@v5 |
| 49 | + with: |
| 50 | + fetch-depth: 0 |
| 51 | + ref: ${{github.head_ref}} |
| 52 | + |
| 53 | + - name: Bump version |
| 54 | + if: steps.version-check.outcome == 'failure' |
| 55 | + run: | |
| 56 | + echo "Bumping version by patch" |
| 57 | + cargo install cargo-bump |
| 58 | + cargo bump patch |
| 59 | + cargo update --workspace |
| 60 | +
|
| 61 | + - name: Commit changes |
| 62 | + if: steps.version-check.outcome == 'failure' |
| 63 | + run: | |
| 64 | + git diff |
| 65 | + git config --global user.name "Login will be determined by the Github API based on the creator of the token" |
| 66 | + git config --global user.email "" |
| 67 | + git commit -am '[dependabot-skip] Bump version' |
| 68 | +
|
| 69 | + - name: Push changes |
| 70 | + if: steps.version-check.outcome == 'failure' |
| 71 | + uses: Asana/push-signed-commits@v1 |
| 72 | + with: |
| 73 | + github-token: ${{secrets.DEPENDABOT_GITHUB_TOKEN}} |
| 74 | + local_branch_name: ${{github.head_ref}} |
| 75 | + remote_branch_name: ${{github.head_ref}} |
0 commit comments