-
Notifications
You must be signed in to change notification settings - Fork 34
122 lines (111 loc) · 5.47 KB
/
release.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
on:
push:
branches: [release]
name: Publish release
jobs:
build:
name: Build, upload and release in the appstore
environment: release
env:
APP_ID: integration_google
runs-on: ubuntu-latest
steps:
- name: Use Node 16
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.2.0
with:
node-version: 16
- name: Set up npm
run: npm i -g npm@^8.0.0
- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
with:
php-version: '7.4'
extensions: mbstring, intl, sqlite3
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get current tag
id: tag
run: |
git fetch --tags --force
tag=$(git tag -l --points-at HEAD)
vtag=$(echo $tag | grep "^v[0-9]\+\.[0-9]\+\.[0-9]\+" || echo "")
echo "##[set-output name=currenttag;]$vtag"
- name: Build project
if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }}
id: build_release
run: |
echo "##[set-output name=app_id;]$APP_ID"
echo "###### copy certificate"
mkdir -p ~/.nextcloud/certificates
echo "$APP_CRT" > ~/.nextcloud/certificates/${APP_ID}.crt
echo "$APP_KEY" > ~/.nextcloud/certificates/${APP_ID}.key
echo "###### install dependencies"
# remove repo answering 402
#sudo rm -f /etc/apt/sources.list.d/github_git-lfs.list
export DEBIAN_FRONTEND=noninteractive
sudo apt update -y
sudo apt install composer make openssl -y
echo "###### installing nextcloud"
mkdir ~/html
git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master ~/html/nextcloud
sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' ~/html/nextcloud/lib/autoloader.php
cp -r $GITHUB_WORKSPACE ~/html/nextcloud/apps/${APP_ID}
php ~/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password"
php ~/html/nextcloud/occ app:enable ${APP_ID}
php ~/html/nextcloud/occ maintenance:mode --off
cd ~/html/nextcloud/apps/${APP_ID}
echo "###### build app"
make
echo "###### make appstore"
tag=${{ steps.tag.outputs.currenttag }}
version=${tag/v/}
webserveruser=runner occ_dir=~/html/nextcloud version=$version make appstore
echo "##[set-output name=version;]$version"
env:
APP_CRT: ${{ secrets.APP_CRT }}
APP_KEY: ${{ secrets.APP_KEY }}
- name: Create Release
if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }}
id: create_release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.currenttag }}
release_name: ${{ steps.tag.outputs.currenttag }}
draft: false
prerelease: false
- name: Upload Release Asset
if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }}
id: upload-release-asset
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/build/${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz
asset_name: ${{ steps.build_release.outputs.app_id }}-${{ steps.build_release.outputs.version }}.tar.gz
asset_content_type: application/gzip
- name: Publish normal release to appstore
if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && !endsWith( steps.tag.outputs.currenttag , 'nightly' ) }}
id: publish
run: |
SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n')
VERSION=${{ steps.build_release.outputs.version }}
DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${APP_ID}-${VERSION}.tar.gz
curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'"}'
env:
APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }}
- name: Publish nightly release to appstore
if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && endsWith( steps.tag.outputs.currenttag , 'nightly' ) }}
id: nightly
run: |
SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n')
VERSION=${{ steps.build_release.outputs.version }}
DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${APP_ID}-${VERSION}.tar.gz
curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'", "nightly": true}'
env:
APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }}