From 6a88441cc149031671f097dd60e9a1d1597be735 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 28 Dec 2020 10:44:45 +0100 Subject: [PATCH] adjust makefile and release action Signed-off-by: Julien Veyssier --- .github/workflows/release.yml | 24 ++++++++++++++++++------ makefile | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 366a879..dced72c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: run: | git fetch --tags --force tag=$(git tag -l --points-at HEAD) - vtag=$(echo $tag | grep "v[0-9]\+\.[0-9]\+\.[0-9]\+" || echo "") + vtag=$(echo $tag | grep "^v[0-9]\+\.[0-9]\+\.[0-9]\+" || echo "") echo "##[set-output name=currenttag;]$vtag" - name: Build project @@ -33,11 +33,12 @@ jobs: echo "$APP_KEY" > ~/.nextcloud/certificates/${APP_ID}.key echo "###### install dependencies" export DEBIAN_FRONTEND=noninteractive - sudo apt-get update -yqq - sudo apt-get install php7.4-mbstring php7.4-sqlite3 npm make openssl -yqq > /dev/null 2>&1 + sudo apt update -y + sudo apt full-upgrade -y + sudo apt install php-mbstring php-sqlite3 npm make openssl -y echo "###### installing nextcloud" mkdir ~/html - git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b stable20 ~/html/nextcloud + git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b master ~/html/nextcloud sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' ~/html/nextcloud/lib/autoloader.php cp -r $GITHUB_WORKSPACE ~/html/nextcloud/apps/${APP_ID} php ~/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password" @@ -45,7 +46,7 @@ jobs: php ~/html/nextcloud/occ maintenance:mode --off cd ~/html/nextcloud/apps/${APP_ID} echo "###### npm install" - npm install + npm ci echo "###### npm run build" npm run build echo "###### make appstore" @@ -82,7 +83,7 @@ jobs: asset_content_type: application/gzip - name: Publish to appstore - if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) }} + if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && !endsWith( steps.tag.outputs.currenttag , 'nightly' ) }} id: publish run: | SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n') @@ -91,3 +92,14 @@ jobs: curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'"}' env: APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }} + + - name: Publish nightly build to appstore + if: ${{ startsWith( steps.tag.outputs.currenttag , 'v' ) && endsWith( steps.tag.outputs.currenttag , 'nightly' ) }} + id: nightly + run: | + SIGNATURE=$(cat /tmp/build/sign.txt | tr -d '\n') + VERSION=${{ steps.build_release.outputs.version }} + DOWNLOAD_URL=https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${APP_ID}-${VERSION}.tar.gz + curl -X POST -H "Authorization: Token $APPSTORE_TOKEN" https://apps.nextcloud.com/api/v1/apps/releases -H "Content-Type: application/json" -d '{"download":"'${DOWNLOAD_URL}'", "signature": "'${SIGNATURE}'", "nightly": true}' + env: + APPSTORE_TOKEN: ${{ secrets.APPSTORE_TOKEN }} diff --git a/makefile b/makefile index c40ca74..0634f85 100644 --- a/makefile +++ b/makefile @@ -47,12 +47,12 @@ endif .PHONY: npm npm: - $(npm) install + $(npm) ci $(npm) run build .PHONY: npm-dev npm-dev: - $(npm) install + $(npm) ci $(npm) run dev clean: