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