Build the App and create release #5
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: Build the App and create realese | |
on: | |
release: | |
type: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup app env | |
run: | | |
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV | |
#echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
echo "APP_VERSION=3.0.0" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.0.0' | |
cache: 'npm' | |
- name: Build ${{ env.APP_NAME }} | |
env: | |
NODE_ENV: production | |
run: | | |
npm ci | |
npm run build --if-present | |
- name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with makefile | |
run: | | |
ls -l | |
make package | |
- name: Sign package | |
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 | |
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt" | |
# 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: Attach tarball to github release | |
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # 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 }}-${{ env.APP_VERSION }}.tar.gz | |
tag: ${{ github.ref }} | |
overwrite: true |