fix: some improvement #28
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: Check Affected and Trigger Build | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
check-affected: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.11.0' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: ${{ github.event.pull_request.base.ref || github.ref_name }} | |
- name: Lint and typecheck | |
run: pnpm nx affected -t lint,typecheck --parallel=3 --configuration=ci | |
- name: Get affected projects | |
id: get-affected | |
run: | | |
if pnpm nx show projects --affected | grep -q "ziyo-fe" | |
then | |
echo "ziyo-fe=yes" >> "$GITHUB_OUTPUT" | |
else | |
echo "ziyo-fe=no" >> "$GITHUB_OUTPUT" | |
fi | |
if pnpm nx show projects --affected | grep -q "ziyo-be" | |
then | |
echo "ziyo-be=yes" >> "$GITHUB_OUTPUT" | |
else | |
echo "ziyo-be=no" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Invoke ziyo-fe build | |
if: steps.get-affected.outputs.ziyo-fe == 'yes' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: build-deploy.yml | |
inputs: '{ "image-name": "ziyo-fe" }' | |
- name: Invoke ziyo-be build | |
if: steps.get-affected.outputs.ziyo-be == 'yes' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: build-deploy.yml | |
inputs: '{ "image-name": "ziyo-be" }' |