-
-
Notifications
You must be signed in to change notification settings - Fork 7
108 lines (93 loc) · 3.95 KB
/
create-release-draft.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
name: Create Release
on:
workflow_dispatch:
env:
APP_NAME: cloud_py_api
jobs:
build_app:
runs-on: ubuntu-latest
name: Build and create release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get release info
run: |
APP_VERSION=$(sed -n "s/<version>\(.*\)<\/version>/\\1/p" ./appinfo/info.xml | tr -d '\t')
IS_NIGHTLY=$(if [[ $APP_VERSION == *"beta"* ]]; then echo "true"; else echo "false"; fi)
echo RELEASE_TAG="v$APP_VERSION" >> $GITHUB_ENV
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION\s.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
if [ "$CHANGELOG" == "" ]; then
echo "changelog is empty!"
exit 1
fi
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "IS_NIGHTLY=$IS_NIGHTLY" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Build
run: |
npm install --deps
npm run build
- name: Install Krankerl
run: |
wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
sudo dpkg -i krankerl_0.14.0_amd64.deb
- name: Package app
run: krankerl package || make appstore
# - name: Get nextcloud-min-version from appinfo
# id: appinfo
# uses: skjnldsv/xpath-action@master
# with:
# filename: ${{ env.APP_NAME }}/appinfo/info.xml
# expression: "//info//dependencies//nextcloud/@min-version"
# - name: Cache nextcloud server
# id: nextcloud_setup
# uses: actions/cache@v3
# with:
# path: nextcloud-${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}.zip
# key: ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# - name: Download nextcloud${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# if: steps.nextcloud_setup.outputs.cache-hit != 'true'
# continue-on-error: true
# id: server-checkout
# run: |
# NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
# unzip latest-$NCVERSION.zip
# - name: Checkout server master fallback
# uses: actions/checkout@v3
# if: ${{ steps.server-checkout.outcome != 'success' }}
# with:
# repository: nextcloud/server
# path: nextcloud
# - name: Sign app
# run: |
# # Extracting release
# cd ${{ env.APP_NAME }}/build/artifacts
# tar -xvf ${{ env.APP_NAME }}.tar.gz
# cd ../../../
# # Setting up keys
# echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
# echo "${{ secrets.APP_PUBLIC_CRT }}" > ${{ env.APP_NAME.key }}
# # Signing
# php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
# # Rebuilding archive
# cd ${{ env.APP_NAME }}/build/artifacts
# tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
- name: Create release draft
uses: ncipollo/[email protected]
with:
name: ${{ env.RELEASE_TAG }}
tag: ${{ env.RELEASE_TAG }}
prerelease: ${{ env.IS_NIGHTLY }}
commit: ${{ github.ref }}
draft: true
body: ${{ env.CHANGELOG }}
artifacts: "build/artifacts/${{ env.APP_NAME }}.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}
artifactErrorsFailBuild: true