|
| 1 | +name: Prepare Release Branch |
| 2 | +env: |
| 3 | + PR_PREFIX: 'Pods Gravity Forms ' |
| 4 | + PR_LABELS: 'Type: Release' |
| 5 | + MILESTONE_PREFIX: 'Pods Gravity Forms ' |
| 6 | + BRANCH_PREFIX: 'release/' |
| 7 | + WPORG_PLUGIN_FILE: 'pods-gravity-forms.php' |
| 8 | + WPORG_PLUGIN_VERSION_CONSTANT_NAME: 'PODS_GF_VERSION' |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + new_plugin_version: |
| 13 | + description: 'New plugin version (without the "-a-1"), defaults to the next incremental version from package.json' |
| 14 | + required: false |
| 15 | + version_increment: |
| 16 | + description: 'OR Version increment scheme (if incrementing the package.json version; patch=x.x.x, minor=x.x, major=x.0)' |
| 17 | + required: true |
| 18 | + type: choice |
| 19 | + default: 'patch' |
| 20 | + options: |
| 21 | + - 'major' |
| 22 | + - 'minor' |
| 23 | + - 'patch' |
| 24 | +jobs: |
| 25 | + prepare_release_branch: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - name: Checkout the code |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + token: ${{ secrets.GH_BOT_PUSH }} |
| 32 | + - name: Maybe use the version number from inputs |
| 33 | + if: ${{ github.event.inputs.new_plugin_version != null && github.event.inputs.new_plugin_version != '' }} |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + echo "PLUGIN_VERSION=${{ github.event.inputs.new_plugin_version }}" >> $GITHUB_ENV |
| 37 | + - name: Maybe lookup the version number from package.json |
| 38 | + id: version-lookup |
| 39 | + if: ${{ github.event.inputs.new_plugin_version == null || github.event.inputs.new_plugin_version == '' }} |
| 40 | + shell: bash |
| 41 | + run: | |
| 42 | + echo "CURRENT_VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT |
| 43 | + - name: Maybe get the next version information |
| 44 | + if: ${{ steps.version-lookup.outputs.CURRENT_VERSION != null && steps.version-lookup.outputs.CURRENT_VERSION != '' }} |
| 45 | + uses: reecetech/version-increment@2023.10.2 |
| 46 | + id: version-increment |
| 47 | + with: |
| 48 | + scheme: semver |
| 49 | + increment: ${{ github.event.inputs.version_increment }} |
| 50 | + - name: Maybe store the next version |
| 51 | + if: ${{ steps.version-increment.outputs.version != null && steps.version-increment.outputs.version != '' }} |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + echo "PLUGIN_VERSION=${{ steps.version-increment.outputs.version }}" >> $GITHUB_ENV |
| 55 | + - name: What are we doing? |
| 56 | + run: | |
| 57 | + echo PLUGIN_VERSION: ${{ env.PLUGIN_VERSION }} |
| 58 | + - name: Run wporg-replace |
| 59 | + uses: sc0ttkclark/wporg-replace@v1.0.7 |
| 60 | + with: |
| 61 | + plugin_version: '${{ env.PLUGIN_VERSION }}-a-1' |
| 62 | + plugin_version_constant_name: ${{ env.WPORG_PLUGIN_VERSION_CONSTANT_NAME }} |
| 63 | + plugin_file: ${{ env.WPORG_PLUGIN_FILE }} |
| 64 | + plugin_path: ${{ github.workspace }} |
| 65 | + - name: Create Milestone |
| 66 | + id: create-milestone |
| 67 | + uses: WyriHaximus/github-action-create-milestone@v1.2.0 |
| 68 | + continue-on-error: true |
| 69 | + with: |
| 70 | + title: '${{ env.MILESTONE_PREFIX }}${{ env.PLUGIN_VERSION }}' |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GH_BOT_PUSH }} |
| 73 | + - name: Create Pull Request |
| 74 | + id: create-pull-request |
| 75 | + uses: peter-evans/create-pull-request@v5.0.2 |
| 76 | + with: |
| 77 | + token: ${{ secrets.GH_BOT_PUSH }} |
| 78 | + branch: '${{ env.BRANCH_PREFIX }}${{ env.PLUGIN_VERSION }}' |
| 79 | + commit-message: 'Set version to ${{ env.PLUGIN_VERSION }}-a-1' |
| 80 | + title: '${{ env.PR_PREFIX }}${{ env.PLUGIN_VERSION }}' |
| 81 | + labels: ${{ env.PR_LABELS }} |
| 82 | + assignees: ${{ github.actor }} |
| 83 | + milestone: ${{ steps.create-milestone.outputs.number }} |
| 84 | + draft: true |
0 commit comments