-
Notifications
You must be signed in to change notification settings - Fork 17
127 lines (104 loc) · 3.79 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
name: Upgrades
on:
pull_request:
push:
branches:
- master
jobs:
changes:
runs-on: ubuntu-latest
outputs:
config: ${{ steps.changes.outputs.config }}
steps:
- uses: actions/checkout@v2
# If the config has not changed, we skip
# It allows us to still have a summary result
- uses: dorny/paths-filter@v2
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@v2
- 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 }}
steps:
- name: Set up php ${{ matrix.config.minPHPVersion }}
uses: shivammathur/setup-php@v2
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 \
|| (
i=5;
while [ $i -gt -0 ]; do
# try to find RC5 to RC1
wget --quiet "https://download.nextcloud.com/server/prereleases/nextcloud-${{ matrix.config.base }}rc$i.zip" -O nextcloud-base.zip && break
i=$(( i - 1 ));
done
);
else wget --quiet https://download.nextcloud.com/server/releases/latest-${{ matrix.config.base }}.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