|
| 1 | +# This workflow is provided via the organization template repository |
| 2 | +# |
| 3 | +# https://github.com/nextcloud/.github |
| 4 | +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization |
| 5 | +# |
| 6 | +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors |
| 7 | +# SPDX-License-Identifier: MIT |
| 8 | + |
| 9 | +name: Update nextcloud/ocp |
| 10 | + |
| 11 | +on: |
| 12 | + workflow_dispatch: |
| 13 | + schedule: |
| 14 | + - cron: "5 2 * * 0" |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + issues: write |
| 19 | + |
| 20 | +jobs: |
| 21 | + update-nextcloud-ocp: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + branches: |
| 28 | + - ${{ github.event.repository.default_branch }} |
| 29 | + - 'stable32' |
| 30 | + - 'stable31' |
| 31 | + |
| 32 | + name: update-nextcloud-ocp-${{ matrix.branches }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - id: checkout |
| 36 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 37 | + with: |
| 38 | + persist-credentials: false |
| 39 | + ref: ${{ matrix.branches }} |
| 40 | + submodules: true |
| 41 | + continue-on-error: true |
| 42 | + |
| 43 | + - name: Set up php8.2 |
| 44 | + if: steps.checkout.outcome == 'success' |
| 45 | + uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 |
| 46 | + with: |
| 47 | + php-version: 8.2 |
| 48 | + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation |
| 49 | + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite |
| 50 | + coverage: none |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + |
| 54 | + - name: Read codeowners |
| 55 | + if: steps.checkout.outcome == 'success' |
| 56 | + id: codeowners |
| 57 | + run: | |
| 58 | + grep '/appinfo/info.xml' .github/CODEOWNERS | cut -f 2- -d ' ' | xargs | awk '{ print "codeowners="$0 }' >> $GITHUB_OUTPUT |
| 59 | + continue-on-error: true |
| 60 | + |
| 61 | + - name: Composer install |
| 62 | + if: steps.checkout.outcome == 'success' |
| 63 | + run: composer install |
| 64 | + |
| 65 | + - name: Composer update nextcloud/ocp # zizmor: ignore[template-injection] |
| 66 | + id: update_branch |
| 67 | + if: ${{ steps.checkout.outcome == 'success' && matrix.branches != 'main' }} |
| 68 | + run: composer require --dev 'nextcloud/ocp:dev-${{ matrix.branches }}' |
| 69 | + |
| 70 | + - name: Raise on issue on failure |
| 71 | + uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0 |
| 72 | + if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_branch.conclusion == 'failure' }} |
| 73 | + with: |
| 74 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}' |
| 76 | + body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}' |
| 77 | + |
| 78 | + - name: Composer update nextcloud/ocp |
| 79 | + id: update_main |
| 80 | + if: ${{ steps.checkout.outcome == 'success' && matrix.branches == 'main' }} |
| 81 | + run: composer require --dev nextcloud/ocp:dev-master |
| 82 | + |
| 83 | + - name: Raise on issue on failure |
| 84 | + uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0 |
| 85 | + if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_main.conclusion == 'failure' }} |
| 86 | + with: |
| 87 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}' |
| 89 | + body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}' |
| 90 | + |
| 91 | + - name: Reset checkout 3rdparty |
| 92 | + if: steps.checkout.outcome == 'success' |
| 93 | + run: | |
| 94 | + git clean -f 3rdparty |
| 95 | + git checkout 3rdparty |
| 96 | + continue-on-error: true |
| 97 | + |
| 98 | + - name: Reset checkout vendor |
| 99 | + if: steps.checkout.outcome == 'success' |
| 100 | + run: | |
| 101 | + git clean -f vendor |
| 102 | + git checkout vendor |
| 103 | + continue-on-error: true |
| 104 | + |
| 105 | + - name: Reset checkout vendor-bin |
| 106 | + if: steps.checkout.outcome == 'success' |
| 107 | + run: | |
| 108 | + git clean -f vendor-bin |
| 109 | + git checkout vendor-bin |
| 110 | + continue-on-error: true |
| 111 | + |
| 112 | + - name: Create Pull Request |
| 113 | + if: steps.checkout.outcome == 'success' |
| 114 | + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 115 | + with: |
| 116 | + token: ${{ secrets.COMMAND_BOT_PAT }} |
| 117 | + commit-message: 'chore(dev-deps): Bump nextcloud/ocp package' |
| 118 | + committer: GitHub <[email protected]> |
| 119 | + author: nextcloud-command <[email protected]> |
| 120 | + signoff: true |
| 121 | + branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp' |
| 122 | + title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency' |
| 123 | + body: | |
| 124 | + Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency |
| 125 | + labels: | |
| 126 | + dependencies |
| 127 | + 3. to review |
0 commit comments