feat(config): introduce configuration builder #1062
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upgrades | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: upgrades-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
config: ${{ steps.changes.outputs.config }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
# If the config has not changed, we skip | |
# It allows us to still have a summary result | |
- uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1 | |
id: changes | |
with: | |
filters: | | |
config: | |
- 'config/config.php' | |
configs: | |
if: needs.changes.outputs.config == 'true' | |
runs-on: ubuntu-latest | |
needs: changes | |
outputs: | |
configs: ${{ steps.build-config.outputs.configs }} | |
name: Initializing ${{matrix.channel}} configs | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Getting config | |
id: get-config | |
run: | | |
# Retrieving non-EOL configs from the matrix channel | |
CONFIGS=$(php -r "echo(json_encode(include 'config/config.php'));" | jq -c) | |
echo "::set-output name=configs::$CONFIGS" | |
- name: Parse configs | |
uses: nextcloud/updater_server@action | |
id: build-config | |
with: | |
# Edit the following line to install packages required to run your script. | |
configs: ${{ steps.get-config.outputs.configs }} | |
upgrades: | |
runs-on: ubuntu-latest | |
needs: configs | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.configs.outputs.configs) }} | |
name: Upgrade from ${{ matrix.config.base }} to ${{ matrix.config.latest }} (${{ matrix.config.channel }}) | |
steps: | |
- name: Set up php ${{ matrix.config.minPHPVersion }} | |
uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # v2.30.4 | |
with: | |
php-version: ${{ matrix.config.minPHPVersion }} | |
extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip | |
coverage: none | |
- name: Fetch release | |
run: | | |
# Check if we have a full version like xx.x.x | |
if ${{ contains(matrix.config.base, '.') }}; | |
then wget --quiet https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.config.base }}.zip -O nextcloud-base.zip \ | |
|| wget --quiet https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}.zip -O nextcloud-base.zip \ | |
|| wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc1.zip" -O nextcloud-base.zip \ | |
|| wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc2.zip" -O nextcloud-base.zip \ | |
|| wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc3.zip" -O nextcloud-base.zip \ | |
|| wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc4.zip" -O nextcloud-base.zip \ | |
|| wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc5.zip" -O nextcloud-base.zip \ | |
|| wget --quiet https://download.nextcloud.com/server/releases/latest-${{ matrix.config.major }}.zip -O nextcloud-base.zip; | |
else wget --quiet https://download.nextcloud.com/server/releases/latest-${{ matrix.config.major }}.zip -O nextcloud-base.zip; | |
fi | |
unzip -q nextcloud-base.zip | |
- name: Setup nextcloud | |
run: | | |
cd nextcloud | |
mkdir data | |
php occ maintenance:install --verbose --admin-user admin --admin-pass admin | |
- name: Fetch upgrade | |
run: | | |
mv nextcloud nextcloud.old | |
wget --quiet ${{ matrix.config.downloadUrl }} -O nextcloud-update.zip | |
unzip -q nextcloud-update.zip | |
- name: Copy necessary files | |
run: | | |
mv nextcloud.old/config/config.php nextcloud/config/config.php | |
mv nextcloud.old/data nextcloud/data | |
- name: Perform upgrade | |
run: | | |
cd nextcloud | |
php occ upgrade | |
- name: Integrity check | |
run: | | |
cd nextcloud | |
php occ integrity:check-core | |
summary: | |
runs-on: ubuntu-latest | |
needs: [changes, upgrades] | |
if: always() | |
name: upgrades-summary | |
steps: | |
- name: Summary status | |
run: if ${{ needs.changes.result == 'success' && needs.upgrades.result != 'success' && needs.upgrades.result != 'skipped' }}; then exit 1; fi |