Build the App and create release #58
Workflow file for this run
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: [prereleased] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- 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 }} | |