From fba52a8dbe4e6fc534fffe6acbfa230f4aa4be3c Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Tue, 23 Aug 2022 09:00:50 +0530 Subject: [PATCH] Add Feature Branch Build --- .github/scripts/verify-build.sh | 12 ++++++++++++ .github/workflows/feature-branch.yaml | 28 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 .github/scripts/verify-build.sh create mode 100644 .github/workflows/feature-branch.yaml diff --git a/.github/scripts/verify-build.sh b/.github/scripts/verify-build.sh new file mode 100755 index 0000000..1893ee6 --- /dev/null +++ b/.github/scripts/verify-build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check if build output at dist is uptodate or not + +# Check files updated in working dir +git status dist -s + +# Raise error if more than 1 files changed in working dir +if [[ ! -z $(git status dist -s) ]]; then + echo "Build at dist is outdated. Update build, push and try again." + exit 1 +fi diff --git a/.github/workflows/feature-branch.yaml b/.github/workflows/feature-branch.yaml new file mode 100644 index 0000000..3c42ad5 --- /dev/null +++ b/.github/workflows/feature-branch.yaml @@ -0,0 +1,28 @@ +name: Feature Branch + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + name: Build + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 12 + + - name: Install dependencies + run: npm install + + - name: Build package + run: npm run build + + - name: Verify build + run: .github/scripts/verify-build.sh