|
1 | | -name: Update dependencies and Docs |
| 1 | +name: Generate Docs |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [main] |
6 | | - schedule: |
7 | | - - cron: "0 */8 * * *" |
| 6 | + workflow_dispatch: |
| 7 | + |
8 | 8 | jobs: |
9 | 9 | generate-docs: |
10 | | - if: github.event.repository.owner.login == 'react18-tools' |
| 10 | + if: github.run_number != 1 && github.event.repository.owner.login == 'react18-tools' |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | permissions: |
13 | 13 | contents: write |
14 | 14 | steps: |
15 | 15 | - uses: actions/checkout@v4 |
16 | 16 | with: |
17 | 17 | token: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + ref: ${{ github.event.before }} |
| 19 | + |
| 20 | + - name: Check if package.json was modified |
| 21 | + id: pub |
| 22 | + run: | |
| 23 | + git fetch origin main && git checkout main |
| 24 | + if git diff --name-only ${{ github.event.before }} HEAD | grep -q "lib/package.json"; then |
| 25 | + echo "file_changed=true" >> $GITHUB_ENV |
| 26 | + else |
| 27 | + echo "file_changed=false" >> $GITHUB_ENV |
| 28 | + fi |
| 29 | +
|
| 30 | + - name: Exit early if lib/package.json was modified |
| 31 | + if: env.file_changed == 'true' |
| 32 | + run: exit 1 |
18 | 33 |
|
19 | 34 | - uses: actions/setup-node@v4 |
20 | 35 | with: |
21 | 36 | registry-url: https://registry.npmjs.org |
22 | 37 | node-version: 20 |
23 | | - - run: npm i -g pnpm && pnpm i |
24 | | - name: Install dependencies |
25 | | - - run: git stash --include-untracked |
26 | | - name: clean up working directory |
27 | | - - run: npx @turbo/codemod update . && pnpm update --latest -r |
28 | | - name: Update dependencies |
29 | | - - run: pnpm build |
30 | | - name: Build all apps to make sure it is not broken due to dependency upgrades |
31 | | - - name: Run unit tests |
32 | | - run: pnpm test |
33 | | - - name: Generate/update docs |
34 | | - run: pnpm doc |
35 | 38 | - name: Setup Git |
36 | 39 | run: | |
37 | 40 | git config --global user.name "mayank1513" |
38 | 41 | git config --global user.email "[email protected]" |
39 | 42 | git fetch |
40 | 43 | git checkout main |
41 | 44 | git pull |
42 | | - - name: Save upgraded packages back to repo |
43 | | - run: git add . && git commit -m "upgrade deps && docs" && git push origin main |
44 | | - - name: Update website |
45 | | - run: | |
46 | | - gh api \ |
47 | | - --method POST \ |
48 | | - -H "Accept: application/vnd.github+json" \ |
49 | | - -H "X-GitHub-Api-Version: 2022-11-28" \ |
50 | | - /repos/mayank1513/r18gs/merge-upstream \ |
51 | | - -f "branch=main" |
52 | | - env: |
53 | | - GH_TOKEN: ${{ secrets.mayank1513PAT }} |
| 45 | + - run: npm i -g pnpm && pnpm i --no-frozen-lockfile |
| 46 | + name: Install dependencies |
| 47 | + - run: git stash --include-untracked |
| 48 | + name: clean up working directory |
| 49 | + - name: Generate/update docs |
| 50 | + run: pnpm doc |
| 51 | + - name: Save docs back to repo |
| 52 | + run: git add . && git commit -m "upgrade deps && docs [skip ci]" && git push origin main |
0 commit comments