1# This workflow is triggered manually and prepares a new release by creating a pull request 2# All needed info is provided by the user in the workflow_dispatch dialog 3# 4# When the pull request is merged, the release-build workflow will be triggered automatically 5 6name: "Release: Preparation " 7on: 8 workflow_dispatch: 9 inputs: 10 type: 11 description: 'What type of release is this?' 12 required: true 13 default: 'stable' 14 type: choice 15 options: 16 - stable 17 - hotfix 18 - rc 19 codename: 20 description: 'The codename for this release, empty for same as last' 21 required: false 22 version: 23 description: 'The version date YYYY-MM-DD, empty for today' 24 required: false 25 26jobs: 27 create: 28 name: Prepare Pull Request 29 runs-on: ubuntu-latest 30 steps: 31 - name: Fail if branch is not master 32 if: github.ref != 'refs/heads/master' 33 run: | 34 echo "::error::This workflow should only be triggered on master" 35 exit 1 36 37 - name: Checkout 38 uses: actions/checkout@v3 39 with: 40 fetch-depth: 0 41 42 - name: Set git identity 43 run: | 44 git config --global user.name "${{ github.actor }}" 45 git config --global user.email "${{ github.actor }}@users.noreply.github.com" 46 47 - name: Prepare Environment 48 run: | 49 php .github/release.php new \ 50 --date "${{ inputs.version }}" \ 51 --name "${{ inputs.codename }}" \ 52 --type "${{ inputs.type }}" \ 53 >> $GITHUB_ENV 54 55 - name: Check if a tag of the new release already exists 56 run: | 57 if git rev-parse "release-${{ env.next_version }}" >/dev/null 2>&1; then 58 echo "::error::Tag already exists, you may need to build a hotfix instead" 59 exit 1 60 fi 61 62 - name: Create merge commit with version info 63 run: | 64 git merge -s ours origin/stable 65 echo '${{ env.next_raw }}' > VERSION 66 git add VERSION 67 sed -i 's/\$updateVersion = "[^"]*";/\$updateVersion = "${{ env.next_update }}";/' doku.php 68 git add doku.php 69 git commit --amend -m 'Release preparations for ${{ env.next_raw }}' 70 git log -1 71 git log origin/stable..master --oneline 72 git checkout -B auto-${{ env.next_version }} 73 git push --set-upstream origin auto-${{ env.next_version }} 74 75 - name: Create pull request 76 uses: repo-sync/pull-request@v2 77 with: 78 source_branch: auto-${{ env.next_version }} 79 destination_branch: stable 80 pr_title: Release Preparations for ${{ env.next_raw }} 81 pr_body: | 82 With accepting this PR, the stable branch will be updated and the whole release and 83 deployment process will be triggered. 84 85 If you're not happy with the contents of this PR, please close it, delete the branch, 86 fix stuff and trigger the workflow again. 87 88 * ${{ env.current_raw }} -> ${{ env.next_raw }} 89 * Update Version ${{ env.current_update }} -> ${{ env.next_update }} 90 91 Before merging this PR, make sure that: 92 93 - [ ] All tests pass on the `master` branch (tests are not executed on PRs created in workflows) 94 - [ ] If this is a new stable release, make sure you merged `stable` into `old-stable` first 95 - [ ] Check that a meaningful [changelog](https://www.dokuwiki.org/changes) exists 96 97 After merging, the release workflow will be triggered automatically. 98 99 After this is done, you need to do the following things manually: 100 101 - [ ] Update the [version symlinks](https://download.dokuwiki.org/admin/) 102 - [ ] Update the update message system 103 - [ ] Announce the release on the mailing list, forum, IRC, social media, etc. 104 105