-
Notifications
You must be signed in to change notification settings - Fork 92
90 lines (73 loc) · 3.38 KB
/
deploy-appstore.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
name: Deploy to app store
on:
push:
tags:
- v*
jobs:
deploy:
name: Deploy codebase to app store
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
working-directory: cookbook
if: github.repository == 'christianlupus-nextcloud/cookbook-releases'
steps:
- name: Checkout the project
uses: actions/checkout@v4
with:
path: cookbook
ref: ${{ github.ref }}
fetch-depth: 0
- name: Get the date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Use cache for NPM
uses: actions/[email protected]
with:
path: |
~/.npm
cookbook/node_modules
key: ${{ runner.os }}-node-${{ steps.date.outputs.date }}-${{ hashFiles('cookbook/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.date.outputs.date }}-
${{ runner.os }}-node-
- name: Install the NPM packages
run: npm ci
- name: Build NPM
run: npm run build
- name: Install composer packages
run: make composer_dist
- name: Extract app version
id: appversion
run: |
version=$(echo ${{ github.ref }} | sed 's@^refs/tags/@@;s@^v@@i')
echo -n "version=" >> $GITHUB_OUTPUT
echo "$version" >> $GITHUB_OUTPUT
if echo $version | grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null
then
echo 'type=stable' >> $GITHUB_OUTPUT
else
echo 'type=beta' >> $GITHUB_OUTPUT
fi
- name: Build the appstore package
run: make appstore
- name: Move the tarball to temp folder
run: cp build/artifacts/appstore/cookbook.tar.gz /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz
- name: Show the size of the tarball
run: ls -lh /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz
- name: Create release
uses: softprops/[email protected]
id: release
with:
files: /tmp/cookbook-${{ steps.appversion.outputs.version }}.tar.gz
prerelease: "${{ steps.appversion.outputs.type == 'beta' }}"
- name: Output asset URL
run: echo "Download URL is ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}"
- name: Upload app to Nextcloud appstore
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
with:
app_name: cookbook
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
download_url: ${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}
app_private_key: ${{ secrets.PRIVATE_KEY }}