|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + trigger-buildkite-pipeline: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Trigger a Buildkite Build |
| 13 | + uses: "buildkite/trigger-pipeline-action@v2.0.0" |
| 14 | + with: |
| 15 | + buildkite_api_access_token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }} |
| 16 | + pipeline: "anza/agave-secondary" |
| 17 | + branch: "${{ github.ref_name }}" |
| 18 | + commit: "HEAD" |
| 19 | + message: ":github: Triggered from a GitHub Action" |
| 20 | + |
| 21 | + draft-release: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Create Release |
| 25 | + uses: actions/github-script@v7 |
| 26 | + with: |
| 27 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + script: | |
| 29 | + github.rest.repos.createRelease({ |
| 30 | + owner: context.repo.owner, |
| 31 | + repo: context.repo.repo, |
| 32 | + tag_name: '${{ github.ref_name }}', |
| 33 | + name: 'Release ${{ github.ref_name }}', |
| 34 | + body: '🚧', |
| 35 | + draft: true, |
| 36 | + prerelease: false |
| 37 | + }) |
| 38 | +
|
| 39 | + version-bump: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + |
| 47 | + - name: Parse Info |
| 48 | + id: parse_info |
| 49 | + run: | |
| 50 | + # get the next version |
| 51 | + version=${{ github.ref_name }} |
| 52 | + major=$(echo $version | cut -d'.' -f1) |
| 53 | + minor=$(echo $version | cut -d'.' -f2) |
| 54 | + patch=$(echo $version | cut -d'.' -f3) |
| 55 | + next_version=$major.$minor.$((patch+1)) |
| 56 | + : "${next_version:?}" |
| 57 | +
|
| 58 | + # get the traget branch |
| 59 | + target_branch=$major.$minor |
| 60 | + : "${target_branch:?}" |
| 61 | +
|
| 62 | + echo "next_version=$next_version" | tee -a $GITHUB_OUTPUT |
| 63 | + echo "target_branch=$target_branch" | tee -a $GITHUB_OUTPUT |
| 64 | +
|
| 65 | + - name: Create branch and make changes |
| 66 | + run: | |
| 67 | + next_version=${{ steps.parse_info.outputs.next_version }} |
| 68 | +
|
| 69 | + git checkout -b version-bump-$next_version |
| 70 | + ./scripts/increment-cargo-version.sh patch |
| 71 | +
|
| 72 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 73 | + git config user.name "github-actions[bot]" |
| 74 | + git commit -am "Bump version to $next_version" |
| 75 | + git push origin version-bump-$next_version |
| 76 | +
|
| 77 | + - name: Create PR |
| 78 | + uses: actions/github-script@v7 |
| 79 | + with: |
| 80 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + script: | |
| 82 | + github.rest.pulls.create({ |
| 83 | + owner: context.repo.owner, |
| 84 | + repo: context.repo.repo, |
| 85 | + title: 'Bump version to ${{ steps.parse_info.outputs.next_version }}', |
| 86 | + head: 'version-bump-${{ steps.parse_info.outputs.next_version }}', |
| 87 | + base: '${{ steps.parse_info.outputs.target_branch }}' |
| 88 | + }) |
0 commit comments