Merge branch 'master' of https://github.com/Servoy/fullcalendarcompon… #2
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 and draft release Servoy Component | |
on: | |
push: | |
branches: | |
- master | |
- 20** | |
- v20** | |
workflow_dispatch: | |
workflow_call: | |
create: | |
branches: | |
- 20** | |
- v20** | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Find component directory | |
id: find_component_dir | |
run: echo "COMPONENT_DIR=$(find . -type d -name 'META-INF' -exec dirname {} \;)" >> $GITHUB_ENV | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
cache: 'npm' | |
cache-dependency-path: ${{ env.COMPONENT_DIR }}/package-lock.json | |
- name: Install and build component | |
working-directory: ${{ env.COMPONENT_DIR }} | |
run: | | |
npm install | |
npm run make_release | |
- name: Extract version number | |
uses: nyaa8/[email protected] | |
with: | |
path: ${{ env.COMPONENT_DIR }}/package.json | |
- name: Get branch name | |
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Check if release exists and is prerelease | |
id: check_release | |
run: | | |
if gh release view "_${{ env.BRANCH_NAME }}" --json isPrerelease --jq '.isPrerelease'; then | |
echo "release_exists=true" >> $GITHUB_ENV | |
else | |
echo "release_exists=false" >> $GITHUB_ENV | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Delete Prerelease release & Tag | |
if: env.release_exists == 'true' | |
run: | | |
gh release delete _${{ env.BRANCH_NAME }} --cleanup-tag --yes | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
run: | | |
gh release create "_${{ github.ref_name }}" --target "${{ env.BRANCH_NAME }}" --prerelease --title "Nighlty Build ${{ env.BRANCH_NAME }}" --notes "Nightly build. Branch: ${{ env.BRANCH_NAME }} Commit: ${{ github.sha }} Package Version: ${{ env.PACKAGE_VERSION }}" | |
echo "release_exists=true" >> $GITHUB_ENV | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload assets | |
if: env.release_exists == 'true' | |
run: | | |
gh release upload "_${{ env.BRANCH_NAME }}" ${{ env.COMPONENT_DIR }}/*.zip | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |