Skip to content

Commit 92b0a88

Browse files
committed
Update workflows
1 parent 8def281 commit 92b0a88

File tree

2 files changed

+75
-29
lines changed

2 files changed

+75
-29
lines changed

.github/workflows/docs.yml

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,63 @@
1-
name: Update dependencies and Docs
1+
name: Generate Docs
22

33
on:
44
push:
55
branches: [main]
6-
schedule:
7-
- cron: "0 */8 * * *"
6+
workflow_dispatch:
7+
88
jobs:
99
generate-docs:
10-
if: github.event.repository.owner.login == 'react18-tools'
10+
if: github.run_number != 1 && github.event.repository.owner.login == 'react18-tools'
1111
runs-on: ubuntu-latest
1212
permissions:
13-
packages: write
1413
contents: write
1514
steps:
1615
- uses: actions/checkout@v4
1716
with:
1817
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
1933

2034
- uses: actions/setup-node@v4
2135
with:
2236
registry-url: https://registry.npmjs.org
2337
node-version: 20
24-
- run: npm i -g pnpm && pnpm i
25-
name: Install dependencies
26-
- name: Build examples
27-
run: pnpm build --filter esbuild-plugin-react18-css-example
28-
- name: Test
29-
run: npm test
30-
- run: git status && git clean -f -d && git status
31-
name: clean up working directory
32-
- run: npx @turbo/codemod update . && pnpm update --latest -w
33-
name: Update dependencies
34-
- run: pnpm build
35-
name: Build all apps to make sure it is not broken due to dependency upgrades
36-
- name: Run unit tests
37-
run: pnpm test
38-
- name: Generate/update docs
39-
run: |
40-
sed -i -e "s/export = cssPlugin/export default cssPlugin/" ./lib/esbuild-plugin-react18-css/src/index.ts
41-
sed -i -e "s/interface/export interface/" ./lib/esbuild-plugin-react18-css/src/index.ts
42-
pnpm doc
43-
sed -i -e "s/export default cssPlugin/export = cssPlugin/" ./lib/esbuild-plugin-react18-css/src/index.ts
44-
sed -i -e "s/export interface/interface/" ./lib/esbuild-plugin-react18-css/src/index.ts
45-
continue-on-error: true
4638
- name: Setup Git
4739
run: |
4840
git config --global user.name "mayank1513"
4941
git config --global user.email "[email protected]"
5042
git fetch
5143
git checkout main
52-
- name: Save upgraded packages back to repo
53-
run: git add . && git commit -m "upgrade deps && docs" && git push origin main
44+
git pull
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
53+
- name: Update website
54+
continue-on-error: true
55+
run: |
56+
gh api \
57+
--method POST \
58+
-H "Accept: application/vnd.github+json" \
59+
-H "X-GitHub-Api-Version: 2022-11-28" \
60+
/repos/mayank1513/turborepo-template/merge-upstream \
61+
-f "branch=main"
62+
env:
63+
GH_TOKEN: ${{ secrets.mayank1513PAT }}

.github/workflows/upgrade.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update dependencies
2+
3+
on:
4+
schedule:
5+
- cron: "0 */8 * * *"
6+
jobs:
7+
update-deps:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
registry-url: https://registry.npmjs.org
19+
node-version: 20
20+
- name: Setup Git
21+
run: |
22+
git config --global user.name "mayank1513"
23+
git config --global user.email "[email protected]"
24+
git fetch
25+
git checkout main
26+
git pull
27+
- run: npm i -g pnpm && pnpm i --no-frozen-lockfile
28+
name: Install dependencies
29+
- run: git stash --include-untracked
30+
name: clean up working directory
31+
- run: pnpx @turbo/codemod update . && pnpm update --latest -r
32+
name: Update dependencies
33+
- run: pnpm build --filter @example/nextjs
34+
name: Build all apps to make sure it is not broken due to dependency upgrades
35+
- name: Save upgraded packages back to repo
36+
run: echo $(date +%F_%H:%M:%S) > .lst && git add . && git commit -m "upgrade deps && docs [skip ci]" && git push origin main

0 commit comments

Comments
 (0)