-
Notifications
You must be signed in to change notification settings - Fork 17
129 lines (105 loc) · 4.63 KB
/
upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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