From 8f581798f4ba3f60aca54cf49ea2f5d7ba38d16a Mon Sep 17 00:00:00 2001 From: Magnus Anderssen Date: Sun, 5 Nov 2023 09:47:56 +0100 Subject: [PATCH] chore: setup tag driven automated release --- .../{release.yml => release-pre.yml} | 5 +- .github/workflows/release-prod.yml | 81 +++++++++++++++++++ appinfo/info.xml | 2 +- 3 files changed, 86 insertions(+), 2 deletions(-) rename .github/workflows/{release.yml => release-pre.yml} (97%) create mode 100644 .github/workflows/release-prod.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release-pre.yml similarity index 97% rename from .github/workflows/release.yml rename to .github/workflows/release-pre.yml index c6346c2..3053b95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-pre.yml @@ -6,6 +6,9 @@ name: Build and publish app release on: release: types: [published] + push: + tags: + - v*-pre* env: APP_NAME: thesearchpage @@ -71,7 +74,7 @@ jobs: appstore_token: ${{ secrets.APPSTORE_TOKEN }} download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} app_private_key: ${{ secrets.APP_PRIVATE_KEY }} - nightly: ${{ github.event.release.prerelease }} + nightly: true - name: Delete crt and key from local storage run: rm -f ~/.nextcloud/certificates/* diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml new file mode 100644 index 0000000..e22a1af --- /dev/null +++ b/.github/workflows/release-prod.yml @@ -0,0 +1,81 @@ +# SPDX-FileCopyrightText: Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +name: Build and publish app release + +on: + release: + types: [published] + push: + tags: + - v* + - '!v*-*' + +env: + APP_NAME: thesearchpage + +jobs: + build_and_publish: + environment: release + runs-on: ubuntu-latest + name: "Release: build, sign and upload the app" + strategy: + matrix: + php-versions: ["8.1"] + nextcloud: ["stable27"] + database: ["sqlite"] + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Setup PHP + uses: shivammathur/setup-php@2.26.0 + with: + php-version: ${{ matrix.php-versions }} + extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip + coverage: none + + - name: Set up server non MySQL + uses: SMillerDev/nextcloud-actions/setup-nextcloud@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd + with: + cron: false + version: ${{ matrix.nextcloud }} + database-type: ${{ matrix.database }} + + - name: Prime app build + run: make + + - name: Configure server with app + uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@fae87e29aa7cdf1ea0b8033c67f60e75b10be2cd + with: + app: ${{ env.APP_NAME }} + check-code: false + + - name: Create signed release archive + run: | + cd ../server/apps/${{ env.APP_NAME }} && make appstore + env: + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} + app_public_crt: ${{ secrets.APP_PUBLIC_CRT }} + + - name: Upload app tarball to release + uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2 + id: attach_to_release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ../server/apps/${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}.tar.gz + asset_name: ${{ env.APP_NAME }}.tar.gz + tag: ${{ github.ref }} + overwrite: true + + - name: Upload app to Nextcloud appstore + uses: R0Wi/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 + with: + app_name: ${{ env.APP_NAME }} + appstore_token: ${{ secrets.APPSTORE_TOKEN }} + download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} + app_private_key: ${{ secrets.APP_PRIVATE_KEY }} + nightly: false + + - name: Delete crt and key from local storage + run: rm -f ~/.nextcloud/certificates/* diff --git a/appinfo/info.xml b/appinfo/info.xml index 4f1cc66..9661e47 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -9,7 +9,7 @@ The Search Page Provides a proper search page - 1.2.0 + 1.2.0-pre agpl Magnus Anderssen TheSearchPage