Skip to content

Commit 442110e

Browse files
committed
initial setup script
0 parents  commit 442110e

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
actions: read
11+
contents: read
12+
13+
jobs:
14+
main:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
filter: tree:0
20+
fetch-depth: 0
21+
22+
# This enables task distribution via Nx Cloud
23+
# Run this command as early as possible, before dependencies are installed
24+
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
25+
# Uncomment this line to enable task distribution
26+
# - run: npx nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="e2e-ci"
27+
28+
# Cache node_modules
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: 'npm'
33+
34+
- run: npm ci --legacy-peer-deps
35+
- run: npx playwright install --with-deps
36+
37+
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
38+
# - run: npx nx-cloud record -- echo Hello World
39+
# When you enable task distribution, run the e2e-ci task instead of e2e
40+
- run: npx nx run-many -t lint test build typecheck e2e
41+
# Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci
42+
- run: npx nx fix-ci
43+
if: always()
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Regenerate Repository
2+
3+
on:
4+
# Manual trigger
5+
workflow_dispatch:
6+
7+
# Weekly schedule (Sundays at 2 AM UTC)
8+
schedule:
9+
- cron: '0 2 * * 0'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
regenerate-template:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout workflow repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js (if needed for generation script)
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '22'
26+
27+
- name: Configure Git
28+
run: |
29+
git config --global user.name "Template Generator Bot"
30+
git config --global user.email "[email protected]"
31+
32+
- name: Clear repository contents (preserve .git)
33+
run: |
34+
# Remove all files except .git directory
35+
find . -mindepth 1 -maxdepth 1 ! -name '.git*' -exec rm -rf {} +
36+
37+
- name: Generate new content
38+
run: |
39+
npx -y create-nx-workspace@latest org --preset=react-monorepo --appName=myapp --routing=true --useReactRouter=false --style=css --bundler=vite --unitTestRunner=vitest --e2eTestRunner=playwright --framework=none --ci=skip --skipGit=true --no-interactive
40+
mv org/* . 2>/dev/null
41+
mv org/.* . 2>/dev/null
42+
rm -rf org
43+
44+
- name: Commit and push changes
45+
env:
46+
GITHUB_TOKEN: ${{ github.token }}
47+
run: |
48+
git add .
49+
if git diff --staged --quiet; then
50+
echo "No changes to commit"
51+
else
52+
git commit -m "🤖 Regenerate repository content - $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
53+
git push origin main
54+
echo "Changes pushed successfully"
55+
fi
56+
57+
- name: Cleanup
58+
if: always()
59+
run: |
60+
rm -rf target-repo

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

0 commit comments

Comments
 (0)