1290ea73dSAndreas Gohr# This workflow is triggered manually and prepares a new release by creating a pull request 2290ea73dSAndreas Gohr# All needed info is provided by the user in the workflow_dispatch dialog 3290ea73dSAndreas Gohr# 4290ea73dSAndreas Gohr# When the pull request is merged, the release-build workflow will be triggered automatically 5290ea73dSAndreas Gohr 6290ea73dSAndreas Gohrname: "Release: Preparation " 7290ea73dSAndreas Gohron: 8290ea73dSAndreas Gohr workflow_dispatch: 9290ea73dSAndreas Gohr inputs: 10290ea73dSAndreas Gohr type: 11290ea73dSAndreas Gohr description: 'What type of release is this?' 12290ea73dSAndreas Gohr required: true 13290ea73dSAndreas Gohr default: 'stable' 14290ea73dSAndreas Gohr type: choice 15290ea73dSAndreas Gohr options: 16290ea73dSAndreas Gohr - stable 17290ea73dSAndreas Gohr - hotfix 18290ea73dSAndreas Gohr - rc 19290ea73dSAndreas Gohr codename: 20290ea73dSAndreas Gohr description: 'The codename for this release, empty for same as last' 21290ea73dSAndreas Gohr required: false 22290ea73dSAndreas Gohr version: 23290ea73dSAndreas Gohr description: 'The version date YYYY-MM-DD, empty for today' 24290ea73dSAndreas Gohr required: false 25290ea73dSAndreas Gohr 26290ea73dSAndreas Gohrjobs: 27290ea73dSAndreas Gohr create: 28290ea73dSAndreas Gohr name: Prepare Pull Request 29290ea73dSAndreas Gohr runs-on: ubuntu-latest 30290ea73dSAndreas Gohr steps: 31290ea73dSAndreas Gohr - name: Fail if branch is not master 32290ea73dSAndreas Gohr if: github.ref != 'refs/heads/master' 33290ea73dSAndreas Gohr run: | 34290ea73dSAndreas Gohr echo "::error::This workflow should only be triggered on master" 35290ea73dSAndreas Gohr exit 1 36290ea73dSAndreas Gohr 37290ea73dSAndreas Gohr - name: Checkout 38290ea73dSAndreas Gohr uses: actions/checkout@v3 39290ea73dSAndreas Gohr with: 40290ea73dSAndreas Gohr fetch-depth: 0 41290ea73dSAndreas Gohr 42290ea73dSAndreas Gohr - name: Set git identity 43290ea73dSAndreas Gohr run: | 44290ea73dSAndreas Gohr git config --global user.name "${{ github.actor }}" 45290ea73dSAndreas Gohr git config --global user.email "${{ github.actor }}@users.noreply.github.com" 46290ea73dSAndreas Gohr 47290ea73dSAndreas Gohr - name: Prepare Environment 48290ea73dSAndreas Gohr run: | 49290ea73dSAndreas Gohr php .github/release.php new \ 50290ea73dSAndreas Gohr --date "${{ inputs.version }}" \ 51290ea73dSAndreas Gohr --name "${{ inputs.codename }}" \ 52290ea73dSAndreas Gohr --type "${{ inputs.type }}" \ 53290ea73dSAndreas Gohr >> $GITHUB_ENV 54290ea73dSAndreas Gohr 55290ea73dSAndreas Gohr - name: Check if a tag of the new release already exists 56290ea73dSAndreas Gohr run: | 57290ea73dSAndreas Gohr if git rev-parse "release-${{ env.next_version }}" >/dev/null 2>&1; then 58290ea73dSAndreas Gohr echo "::error::Tag already exists, you may need to build a hotfix instead" 59290ea73dSAndreas Gohr exit 1 60290ea73dSAndreas Gohr fi 61290ea73dSAndreas Gohr 62290ea73dSAndreas Gohr - name: Create merge commit with version info 63290ea73dSAndreas Gohr run: | 64290ea73dSAndreas Gohr git merge -s ours origin/stable 65290ea73dSAndreas Gohr echo '${{ env.next_raw }}' > VERSION 66290ea73dSAndreas Gohr git add VERSION 67*66966f8dSAndreas Gohr sed -i 's/\$updateVersion = "[^"]*";/\$updateVersion = "${{ env.next_update }}";/' doku.php 68*66966f8dSAndreas Gohr git add doku.php 69290ea73dSAndreas Gohr git commit --amend -m 'Release preparations for ${{ env.next_raw }}' 70290ea73dSAndreas Gohr git log -1 71290ea73dSAndreas Gohr git log origin/stable..master --oneline 72290ea73dSAndreas Gohr git checkout -B auto-${{ env.next_version }} 73290ea73dSAndreas Gohr git push --set-upstream origin auto-${{ env.next_version }} 74290ea73dSAndreas Gohr 75290ea73dSAndreas Gohr - name: Create pull request 76290ea73dSAndreas Gohr uses: repo-sync/pull-request@v2 77290ea73dSAndreas Gohr with: 78290ea73dSAndreas Gohr source_branch: auto-${{ env.next_version }} 79290ea73dSAndreas Gohr destination_branch: stable 80290ea73dSAndreas Gohr pr_title: Release Preparations for ${{ env.next_raw }} 81290ea73dSAndreas Gohr pr_body: | 82*66966f8dSAndreas Gohr With accepting this PR, the stable branch will be updated and the whole release and 83290ea73dSAndreas Gohr deployment process will be triggered. 84290ea73dSAndreas Gohr 85*66966f8dSAndreas Gohr If you're not happy with the contents of this PR, please close it, delete the branch, 86*66966f8dSAndreas Gohr fix stuff and trigger the workflow again. 87290ea73dSAndreas Gohr 88290ea73dSAndreas Gohr * ${{ env.current_raw }} -> ${{ env.next_raw }} 89290ea73dSAndreas Gohr * Update Version ${{ env.current_update }} -> ${{ env.next_update }} 90290ea73dSAndreas Gohr 91290ea73dSAndreas Gohr Before merging this PR, make sure that: 92290ea73dSAndreas Gohr 93*66966f8dSAndreas Gohr - [ ] All tests pass on the `master` branch (tests are not executed on PRs created in workflows) 94290ea73dSAndreas Gohr - [ ] If this is a new stable release, make sure you merged `stable` into `old-stable` first 95290ea73dSAndreas Gohr - [ ] Check that a meaningful [changelog](https://www.dokuwiki.org/changes) exists 96290ea73dSAndreas Gohr 97290ea73dSAndreas Gohr After merging, the release workflow will be triggered automatically. 98290ea73dSAndreas Gohr 99290ea73dSAndreas Gohr After this is done, you need to do the following things manually: 100290ea73dSAndreas Gohr 101290ea73dSAndreas Gohr - [ ] Update the [version symlinks](https://download.dokuwiki.org/admin/) 102290ea73dSAndreas Gohr - [ ] Update the update message system 103290ea73dSAndreas Gohr - [ ] Announce the release on the mailing list, forum, IRC, social media, etc. 104290ea73dSAndreas Gohr 105