|
1 | | -name: Build, Test, and Commit |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - main |
10 | | - |
11 | | -jobs: |
12 | | - build-test: |
13 | | - runs-on: ubuntu-latest |
14 | | - |
15 | | - steps: |
16 | | - - name: Checkout repository |
17 | | - uses: actions/checkout@v2 |
18 | | - |
19 | | - - name: Set up Node.js |
20 | | - uses: actions/setup-node@v2 |
21 | | - with: |
22 | | - node-version: '14' |
23 | | - |
24 | | - - name: Install dependencies |
25 | | - run: npm install |
26 | | - |
27 | | - - name: Build project |
28 | | - run: npm run build |
29 | | - |
30 | | - - name: Run tests |
31 | | - run: npm test |
32 | | - |
33 | | - - name: Commit built files |
34 | | - if: success() # Only commit if the previous steps were successful |
35 | | - run: | |
36 | | - git config --global user.name "github-actions[bot]" |
37 | | - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
38 | | - git add lib |
39 | | - git commit -m "Add built files" || echo "No changes to commit" |
40 | | -
|
41 | | - - name: Push changes |
42 | | - if: success() # Only push if the previous steps were successful |
43 | | - env: |
44 | | - GH_TOKEN: ${{ secrets.GH_TOKEN }} |
45 | | - run: | |
46 | | - git push origin main |
| 1 | +name: Build, Test, and Commit |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Set up Node.js |
| 20 | + uses: actions/setup-node@v2 |
| 21 | + with: |
| 22 | + node-version: '14' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: npm install |
| 26 | + |
| 27 | + - name: Build project |
| 28 | + run: npm run build |
| 29 | + |
| 30 | + - name: Run tests |
| 31 | + run: npm test |
| 32 | + |
| 33 | + - name: Commit built files |
| 34 | + if: success() # Only commit if the previous steps were successful |
| 35 | + run: | |
| 36 | + git config --global user.name "github-actions[bot]" |
| 37 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 38 | + git add lib |
| 39 | + git commit -m "Add built files" || echo "No changes to commit" |
| 40 | +
|
| 41 | + - name: Push changes |
| 42 | + if: success() # Only push if the previous steps were successful |
| 43 | + env: |
| 44 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 45 | + run: | |
| 46 | + git push origin main |
0 commit comments