From 83a8fe14195791d6a67b00e751a2f3af10880cc6 Mon Sep 17 00:00:00 2001 From: suryag23 Date: Thu, 28 Nov 2024 13:19:32 +0530 Subject: [PATCH] Workflow to create dist --- .github/workflows/prerelease.yml | 50 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 43 +++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/prerelease.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..7f5a35a --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,50 @@ +name: Build Dist when the commit is merged + +on: + pull_request: + branches: + - main + - develop + types: + - closed + +jobs: + build: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install global tools + run: | + npm install -g @lightningjs/cli typescript + lng --version + + - name: Install project dependencies + run: npm install + working-directory: ./accelerator-home-ui + + - name: Remove existing dist folder + run: | + echo "removing the dist" + test -d "./accelerator-home-ui/dist" && rm -rf "./accelerator-home-ui/dist" + + - name: Build project + run: lng dist + working-directory: ./accelerator-home-ui + + - name: Checking for Dist + run: | + if test -d "./accelerator-home-ui/dist"; then + bash lng_script.sh + fi + + - name: to move dist and remove es6 + run: mv ./accelerator-home-ui/dist/es6/* ./accelerator-home-ui/dist && rm -d ./accelerator-home-ui/dist/es6 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2259afb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Build Dist when tag is created + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Remove existing dist folder + run: | + test -d "./accelerator-home-ui/dist" && rm -rf "./accelerator-home-ui/dist" + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install global tools + run: | + npm install -g @lightningjs/cli typescript + lng --version + - name: Install project dependencies + run: npm install + working-directory: ./accelerator-home-ui + + - name: Build project + run: lng dist + working-directory: ./accelerator-home-ui + + - name: Checking for Dist + run: | + if test -d "./accelerator-home-ui/dist"; then + bash lng_script.sh + fi + - name: to move dist and remove es6 + run: mv ./accelerator-home-ui/dist/es6/* ./accelerator-home-ui/dist && rm -d ./accelerator-home-ui/dist/es6