|
| 1 | +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 2 | +# SPDX-License-Identifier: AGPL-3.0-or-later |
| 3 | +# |
| 4 | +# Packages the Recognize ExApp manifest and uploads it to the Nextcloud App Store. |
| 5 | +# The Docker image itself is built and pushed by exapp-publish-docker.yml; the App |
| 6 | +# Store only stores the manifest (appinfo/info.xml) and points at the registry. |
| 7 | + |
| 8 | +name: Build and publish Recognize ExApp |
| 9 | + |
| 10 | +on: |
| 11 | + release: |
| 12 | + types: [published] |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + |
| 18 | +env: |
| 19 | + APP_ID: recognize_exapp |
| 20 | + |
| 21 | +jobs: |
| 22 | + build_and_publish: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + if: ${{ github.repository_owner == 'nextcloud' }} |
| 25 | + steps: |
| 26 | + - name: Check actor permission |
| 27 | + uses: skjnldsv/check-actor-permission@v3.0 |
| 28 | + with: |
| 29 | + require: write |
| 30 | + |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + persist-credentials: false |
| 35 | + path: recognize |
| 36 | + |
| 37 | + - name: Stage ExApp for packaging |
| 38 | + run: cp -r recognize/exapp "$APP_ID" |
| 39 | + |
| 40 | + - name: Get app version number |
| 41 | + id: app-version |
| 42 | + uses: skjnldsv/xpath-action@v1.0.0 |
| 43 | + with: |
| 44 | + filename: ${{ env.APP_ID }}/appinfo/info.xml |
| 45 | + expression: "//info//version/text()" |
| 46 | + |
| 47 | + - name: Get appinfo data |
| 48 | + id: appinfo |
| 49 | + uses: skjnldsv/xpath-action@v1.0.0 |
| 50 | + with: |
| 51 | + filename: ${{ env.APP_ID }}/appinfo/info.xml |
| 52 | + expression: "//info//dependencies//nextcloud/@min-version" |
| 53 | + |
| 54 | + - name: Install Krankerl |
| 55 | + run: | |
| 56 | + wget -q https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb |
| 57 | + sudo dpkg -i krankerl_0.14.0_amd64.deb |
| 58 | +
|
| 59 | + - name: Package ${{ env.APP_ID }} with krankerl |
| 60 | + run: | |
| 61 | + cd "$APP_ID" |
| 62 | + krankerl package |
| 63 | +
|
| 64 | + - name: Checkout server |
| 65 | + continue-on-error: true |
| 66 | + id: server-checkout |
| 67 | + run: | |
| 68 | + NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}' |
| 69 | + wget --quiet "https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip" |
| 70 | + unzip "latest-$NCVERSION.zip" |
| 71 | +
|
| 72 | + - name: Checkout server master fallback |
| 73 | + uses: actions/checkout@v4 |
| 74 | + if: ${{ steps.server-checkout.outcome != 'success' }} |
| 75 | + with: |
| 76 | + persist-credentials: false |
| 77 | + submodules: true |
| 78 | + repository: nextcloud/server |
| 79 | + path: nextcloud |
| 80 | + |
| 81 | + - name: Sign app |
| 82 | + run: | |
| 83 | + cd "$APP_ID/build/artifacts" |
| 84 | + tar -xvf "$APP_ID.tar.gz" |
| 85 | + cd ../../../ |
| 86 | + echo '${{ secrets.APP_PRIVATE_KEY }}' > "$APP_ID.key" |
| 87 | + wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/$APP_ID/$APP_ID.crt" |
| 88 | + php nextcloud/occ integrity:sign-app --privateKey="$APP_ID.key" --certificate="$APP_ID.crt" --path="$APP_ID/build/artifacts/$APP_ID" |
| 89 | + cd "$APP_ID/build/artifacts" |
| 90 | + tar -zcvf "$APP_ID.tar.gz" "$APP_ID" |
| 91 | +
|
| 92 | + - name: Attach tarball to github release |
| 93 | + uses: svenstaro/upload-release-action@v2 |
| 94 | + id: attach_to_release |
| 95 | + with: |
| 96 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 97 | + file: ${{ env.APP_ID }}/build/artifacts/${{ env.APP_ID }}.tar.gz |
| 98 | + asset_name: ${{ env.APP_ID }}-${{ github.ref_name }}.tar.gz |
| 99 | + tag: ${{ github.ref }} |
| 100 | + overwrite: true |
| 101 | + |
| 102 | + - name: Upload app to Nextcloud appstore |
| 103 | + uses: nextcloud-releases/nextcloud-appstore-push-action@v1.0.3 |
| 104 | + with: |
| 105 | + app_name: ${{ env.APP_ID }} |
| 106 | + appstore_token: ${{ secrets.APPSTORE_TOKEN }} |
| 107 | + download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} |
| 108 | + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} |
0 commit comments