Skip to content

Commit

Permalink
1.19.0 metadata fixes + auto release via Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
R0Wi authored Sep 12, 2020
1 parent dcd59d0 commit c631e3d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- master
- stable*
release:
types: [published]

env:
APP_NAME: workflow_ocr
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and publish app release

on:
release:
types: [published]

env:
APP_NAME: workflow_ocr

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.APP_NAME }}
- name: Run build
run: cd ${{ env.APP_NAME }} && make appstore
- name: Upload app tarball to release
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.APP_NAME }}/build/artifacts/appstore/${{ env.APP_NAME }}.tar.gz
asset_name: ${{ env.APP_NAME }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
# TODO: maybe path appinfo.xml with current version
- name: Upload app to Nextcloud appstore
env:
APP_NAME: ${{ env.APP_NAME }}
APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }}
NIGHTLY: ${{ github.event.release.prerelease }}
DOWNLOAD_URL: ${{ steps.attach_to_release.outputs.browser_download_url }}
ENCRYPTED_PK_PATH: ${{ github.workspace }}/${{ env.APP_NAME }}/.github/workflows/secrets/${{ env.APP_NAME }}.key.enc
PK_DECRYPT_PW: ${{ secrets.APP_PK_ENCRYPTION_KEY }}
run: |
cd ${{ env.APP_NAME }}/.github/workflows/scripts
chmod +x push_appstore.sh
./push_appstore.sh
21 changes: 21 additions & 0 deletions .github/workflows/scripts/push_appstore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Used env-variables:
# APP_NAME
# APPSTORE_TOKEN
# NIGHTLY
# DOWNLOAD_URL
# ENCRYPTED_PK_PATH
# PK_DECRYPT_PW

echo "Downloading app tarball for signing"
wget "$DOWNLOAD_URL" -O "${APP_NAME}.tar.gz"

echo "Decrypt signing key"
openssl aes-256-cbc -in $ENCRYPTED_PK_PATH -out ${APP_NAME}.key -pass pass:${PK_DECRYPT_PW} -d -iter 1000 -salt

echo "Creating signature for app release"
sign="`openssl dgst -sha512 -sign ${APP_NAME}.key ${APP_NAME}.tar.gz | openssl base64 -A`"

echo "Creating new app release in Nextcloud appstore (nightly=${NIGHTLY})"
curl -X POST https://apps.nextcloud.com/api/v1/apps/releases -H "Authorization: Token ${APPSTORE_TOKEN}" -H "Content-Type: application/json" -d "{\"download\":\"${DOWNLOAD_URL}\", \"signature\": \"${sign}\", \"nightly\": ${NIGHTLY} }"
Binary file added .github/workflows/secrets/workflow_ocr.key.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<website>https://github.com/R0Wi/workflow_ocr</website>
<bugs>https://github.com/R0Wi/workflow_ocr/issues</bugs>
<repository type="git">https://github.com/R0Wi/workflow_ocr.git</repository>
<screenshot>https://github.com/R0Wi/workflow_ocr/blob/eb2d65e9610406bbab22c4c8dda1cea015b5c791/doc/img/usage_1.jpg</screenshot>
<screenshot>https://github.com/R0Wi/workflow_ocr/blob/eb2d65e9610406bbab22c4c8dda1cea015b5c791/doc/img/usage_1.jpg?raw=true</screenshot>
<dependencies>
<nextcloud min-version="19" max-version="19" />
</dependencies>
Expand Down

0 comments on commit c631e3d

Please sign in to comment.