Publish to Nextcloud app store #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Nextcloud app store | |
on: | |
workflow_dispatch: | |
env: | |
APP_NAME: mediadc | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Get release url | |
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) | |
REP_NAME=${{github.repository_owner}} | |
RELEASE_URL=https://github.com/$REP_NAME/$APP_NAME/releases/download/v$APP_VERSION/$APP_NAME.tar.gz | |
curl -f --output app.tar.gz -L $RELEASE_URL | |
echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV | |
echo "IS_NIGHTLY=$IS_NIGHTLY" >> $GITHUB_ENV | |
- name: Prepare signature data | |
env: | |
NEXTCLOUD_APPSTORE_SIGNING_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | |
run: 'echo "$NEXTCLOUD_APPSTORE_SIGNING_PRIVATE_KEY" > app.key' | |
- name: Sign release package | |
run: | | |
RELEASE_SIGNATURE="$(openssl dgst -sha512 -sign app.key app.tar.gz | openssl base64 -A)" | |
echo "RELEASE_SIGNATURE=$RELEASE_SIGNATURE" >> $GITHUB_ENV | |
- name: Publish release in app store | |
env: | |
NEXTCLOUD_APPSTORE_API_TOKEN: ${{ secrets.APP_STORE_TOKEN }} | |
run: 'curl -f -X POST https://apps.nextcloud.com/api/v1/apps/releases -H "Authorization: Token $NEXTCLOUD_APPSTORE_API_TOKEN" -H "Content-Type: application/json" -d ''{"download":"''$RELEASE_URL''","signature": "''$RELEASE_SIGNATURE''","nightly": "''$IS_NIGHTLY''"}''' |