Skip to content

Build the App and create release #74

Build the App and create release

Build the App and create release #74

Workflow file for this run

name: Build the App and create release
on:
release:
types: [prereleased]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Event type
run: |
echo "event name is:" ${{ github.event_name }}
echo "event type is:" ${{ github.event.action }}
- name: Setup app env
run: |
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
echo "APP_RELEASE=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "APP_VERSION=${GITHUB_REF##*/V}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.APP_NAME }}
- name: Get appinfo data
id: appinfo
uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
with:
filename: ${{ env.APP_NAME }}/appinfo/info.xml
expression: "//info//dependencies//nextcloud/@min-version"
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
# Continue if no package.json
continue-on-error: true
with:
path: ${{ env.APP_NAME }}
fallbackNode: '^20'
fallbackNpm: '^10'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
# Skip if no package.json
if: ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
- name: Build ${{ env.APP_NAME }}
run: |
cd ${{ env.APP_NAME }}
npm ci
npm run build
- name: Package ${{ env.APP_NAME }} ${{ env.APP_VERSION }} with makefile
run: |
cd ${{ env.APP_NAME }}
make package
- name: Changelog release
id: changelog
uses: 3liz/[email protected]
with:
tag_name: ${{ env.APP_VERSION }}
changelog_file: ${{ env.APP_NAME }}/CHANGELOG.md
- name: Attach tarball to github release
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.APP_NAME }}/build/${{ env.APP_NAME }}.tar.gz
asset_name: ${{ env.APP_NAME }}.tar.gz
tag: ${{ github.ref }}
draft: true
overwrite: true
body: ${{ steps.changelog.outputs.markdown }}
release_name: ${{ env.APP_RELEASE }}