From a2417c203185eea2995266df7058746cacf7b28c Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Thu, 23 Mar 2023 08:25:46 +0100 Subject: [PATCH] ci: add release ci job --- .github/workflows/create_release.yml | 84 ++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/create_release.yml diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000..f362ccf --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,84 @@ +name: '🗃️ Create empty release' + +on: + push: + branches: + - release + tags-ignore: + - '*' + workflow_dispatch: + +env: + APP_NAME: qownnotesapi + +jobs: + create_release: + name: '🗃️️ Prepare release' + permissions: + contents: write # for actions/create-release to create a release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + release_id: ${{ steps.create_release.outputs.id }} + steps: + - uses: actions/checkout@v3 + - name: Install libxml2-utils + run: sudo apt-get install libxml2-utils + - name: Set Env + run: | + export VERSION=$(xmllint --xpath "string(/info/version)" appinfo/info.xml) + export TAG=v${VERSION} + export RELEASE_TEXT=$(grep -Pzo "## ${VERSION}\n(\n|.)+?\n##" CHANGELOG.md | sed '$ d') + echo "VERSION=${VERSION}" >> $GITHUB_ENV + echo "TAG=${TAG}" >> $GITHUB_ENV + # add multiline release text + echo "RELEASE_TEXT<> $GITHUB_ENV + echo "${RELEASE_TEXT}" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - name: Printenv + run: | + echo "VERSION=${VERSION}" + echo "TAG=${TAG}" + echo "RELEASE_TEXT=${RELEASE_TEXT}" + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.TAG }} + release_name: Release v${{ env.VERSION }} + body: ${{ env.RELEASE_TEXT }} + draft: true + prerelease: false + +# build_and_publish: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# path: ${{ env.APP_NAME }} +# - name: Install NPM packages +# run: cd ${{ env.APP_NAME }} && make npm-init +# - name: Build JS +# run: cd ${{ env.APP_NAME }} && make build-js-production +# - name: Create release tarball +# 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/${{ 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@v1.0.3 +# 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