|
| 1 | +name: Create release branch |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + BRANCH_NAME: |
| 7 | + description: The source branch to work with, if not implicit |
| 8 | + required: false |
| 9 | + NEW_VERSION: |
| 10 | + description: New version to set in the source branch (e.g. 5.6.0) |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + prepare: |
| 15 | + name: Prepare |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + branch_name: ${{ inputs.BRANCH_NAME || github.ref_name }} |
| 19 | + steps: |
| 20 | + - run: exit 0 |
| 21 | + |
| 22 | + make-branch: |
| 23 | + name: Make branch |
| 24 | + runs-on: ubuntu-latest |
| 25 | + needs: |
| 26 | + - prepare |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v5 |
| 29 | + with: |
| 30 | + ref: ${{ needs.prepare.outputs.branch_name }} |
| 31 | + |
| 32 | + - name: Determine project version |
| 33 | + id: project_version |
| 34 | + run: | |
| 35 | + echo "version=$(jq --raw-output '.version' vcpkg.json)" >> ${GITHUB_OUTPUT} |
| 36 | +
|
| 37 | + - name: Create `${{ steps.project_version.outputs.version }}` branch |
| 38 | + run: | |
| 39 | + git checkout -b ${{ steps.project_version.outputs.version }} |
| 40 | + git push origin ${{ steps.project_version.outputs.version }} |
| 41 | +
|
| 42 | + update-version: |
| 43 | + name: Update version in `${{ needs.prepare.outputs.branch_name }}` to `${{ inputs.NEW_VERSION }}` |
| 44 | + runs-on: ubuntu-latest |
| 45 | + needs: |
| 46 | + - prepare |
| 47 | + env: |
| 48 | + NEW_VERSION: ${{ inputs.NEW_VERSION }} |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v5 |
| 51 | + with: |
| 52 | + ref: ${{ needs.prepare.outputs.branch_name }} |
| 53 | + |
| 54 | + - name: Update `vcpkg.json` |
| 55 | + run: | |
| 56 | + cat <<< $(jq --arg ver "${NEW_VERSION}" '.version = $ver' vcpkg.json) > vcpkg.json |
| 57 | +
|
| 58 | + - name: Update `CMakeLists.txt`s |
| 59 | + run: | |
| 60 | + find . -name 'CMakeLists.txt' | \ |
| 61 | + xargs perl -0777 -i -pe 's/(project\s*\([^)]*?\bVERSION\s+)\S+/\1$ENV{NEW_VERSION}/s' |
| 62 | +
|
| 63 | + - name: Create Pull Request |
| 64 | + uses: peter-evans/create-pull-request@v7 |
| 65 | + with: |
| 66 | + branch: Update_version_to_${{ inputs.NEW_VERSION }}_run_${{ github.run_id }} |
| 67 | + title: Update development version to `${{ inputs.NEW_VERSION }}` |
| 68 | + body: "" |
0 commit comments