Skip to content

Commit

Permalink
Added auto build action
Browse files Browse the repository at this point in the history
Added auto build action
  • Loading branch information
RvVeen committed Dec 8, 2024
1 parent 1ebb917 commit e347abd
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/buildDraftRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and draft release Servoy Component

on:
push:
branches:
- master
- 20**
- v20**
workflow_dispatch:
create:
branches:
- 20**
- v20**

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
cache-dependency-path: ./component/package-lock.json

- name: Install and build component
working-directory: ./component
run: |
npm install
npm run make_release
- name: Extract version number
uses: nyaa8/package-version@v1.0.3
with:
path: ./component/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 }}" ./component/*.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e347abd

Please sign in to comment.