Skip to content

Create Release

Create Release #58

name: Create Release
on:
workflow_dispatch:
env:
APP_NAME: mediadc
jobs:
build_app:
runs-on: ubuntu-latest
name: Build and create release
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Download artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: generate-binaries-2.yml
workflow_conclusion: ""
- name: Get release info
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)
echo RELEASE_TAG="v$APP_VERSION" >> $GITHUB_ENV
CHANGELOG=$(grep -oPz "(?s)##\s\[$APP_VERSION\s.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
if [ "$CHANGELOG" == "" ]; then
echo "changelog is empty!"
exit 1
fi
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "IS_NIGHTLY=$IS_NIGHTLY" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Build
run: |
npm install --deps
npm run build
- name: Install Krankerl
run: |
wget https://github.com/ChristophWurst/krankerl/releases/download/v0.14.0/krankerl_0.14.0_amd64.deb
sudo dpkg -i krankerl_0.14.0_amd64.deb
- name: Package app
run: krankerl package || make appstore
# - name: Get nextcloud-min-version from appinfo
# id: appinfo
# uses: skjnldsv/xpath-action@master
# with:
# filename: ${{ env.APP_NAME }}/appinfo/info.xml
# expression: "//info//dependencies//nextcloud/@min-version"
# - name: Cache nextcloud server
# id: nextcloud_setup
# uses: actions/cache@v3
# with:
# path: nextcloud-${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}.zip
# key: ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# - name: Download nextcloud ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# if: steps.nextcloud_setup.outputs.cache-hit != 'true'
# continue-on-error: true
# id: server-checkout
# run: |
# NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
# wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
# unzip latest-$NCVERSION.zip
# - name: Checkout server master fallback
# uses: actions/checkout@v3
# if: ${{ steps.server-checkout.outcome != 'success' }}
# with:
# repository: nextcloud/server
# path: nextcloud
# - name: Sign app
# run: |
# # Extracting release
# cd ${{ env.APP_NAME }}/build/artifacts
# tar -xvf ${{ env.APP_NAME }}.tar.gz
# cd ../../../
# # Setting up keys
# echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
# echo "${{ secrets.APP_PUBLIC_CRT }}" > ${{ env.APP_NAME.key }}
# # Signing
# php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
# # Rebuilding archive
# cd ${{ env.APP_NAME }}/build/artifacts
# tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
- name: Create release draft
uses: ncipollo/release-action@v1.13.0
with:
name: ${{ env.RELEASE_TAG }}
tag: ${{ env.RELEASE_TAG }}
prerelease: ${{ env.IS_NIGHTLY }}
commit: ${{ github.ref }}
draft: true
body: ${{ env.CHANGELOG }}
artifacts: "build/artifacts/${{ env.APP_NAME }}.tar.gz,cp_binaries/*"
token: ${{ secrets.GITHUB_TOKEN }}
artifactErrorsFailBuild: true