diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..88bc05f --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,20 @@ +name: Setup + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install Dependencies + run: yarn install + shell: bash + + - name: Check for changes to yarn.lock + run: git diff --exit-code + shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..daef687 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish + +on: + workflow_dispatch: + +jobs: + quality_checks: + uses: Optum/react-hooks/.github/workflows/quality-checks.yml@add_quality_checks + + publish: + runs-on: ubuntu-latest + needs: quality_checks + steps: + - name: Verify main branch + if: github.ref_name != 'main' + run: | + echo "Invalid branch: can only publish from main" + exit 1 + + - name: Setup + uses: Optum/react-hooks/.github/actions/setup@add_quality_checks + + - name: Publish + run: echo Publishing... + diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml new file mode 100644 index 0000000..9ab0213 --- /dev/null +++ b/.github/workflows/quality-checks.yml @@ -0,0 +1,27 @@ +name: Quality Checks + +on: + workflow_dispatch: + pull_request: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup + uses: Optum/react-hooks/.github/actions/setup@add_quality_checks + + - name: Run TypeScript Build + run: yarn build + + test: + runs-on: ubuntu-latest + steps: + - name: Setup + uses: Optum/react-hooks/.github/actions/setup@add_quality_checks + + - name: Run Unit Tests + run: yarn jest + +