Skip to content

Commit

Permalink
ci: added conditions
Browse files Browse the repository at this point in the history
- only run on src or __test__ changes
  • Loading branch information
Bugs5382 committed Jun 25, 2024
1 parent 1528b5b commit 1cf89e4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/deploy-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,40 @@ permissions:
jobs:
Test:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
test: ${{ steps.filter.outputs.test }}
strategy:
matrix:
node-version: [ 20.x, 'lts/*' ]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dorny/[email protected]
id: filter
with:
filters: |
src:
- 'src/**'
test:
- '__tests__/**
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
if: steps.filter.outputs.src == 'true' && steps.filter.outputs.test == 'true'
run: npm install --ignore-scripts
- name: Run Lint Fix
if: steps.filter.outputs.src == 'true' && steps.filter.outputs.test == 'true'
run: npm run lint:fix
- name: Run Unit Tests
if: steps.filter.outputs.src == 'true' && steps.filter.outputs.test == 'true'
run: npm run test
Release:
runs-on: ubuntu-latest
if: ${{ needs.Test.outputs.src == 'true' && needs.Test.outputs.test == 'true' }}
needs: [ 'Test' ]
steps:
- uses: actions/checkout@v4
Expand All @@ -57,6 +72,10 @@ jobs:
needs: [ 'Release' ]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
ref: main
- name: Configure Git
run: |
git config --global user.email "[email protected]"
Expand Down

0 comments on commit 1cf89e4

Please sign in to comment.