-
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 2.05 KB
/
Copy pathinitial-setup.yml
File metadata and controls
72 lines (58 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: initial repository setup
on:
push:
branches:
- main
env:
USER_NAME: ${{ github.repository_owner }}
PROJECT_NAME: ${{ github.event.repository.name }}
PROJECT_DESC: ${{ github.event.repository.description }}
jobs:
setup:
# Only run on repos generated from the template, never on a template itself.
if: ${{ !github.event.repository.is_template }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Swap in the generated project's files
run: |
# Delete template LICENSE
rm -f LICENSE
# _new_project mirrors the repo layout. Add files there, not here.
cp -r _new_project/. .
rm -rf _new_project
# Drop the docs pages that only document the template itself.
rm -f docs/getting-started.md docs/project-layout.md \
docs/writing-your-tool.md docs/testing.md docs/ci.md \
docs/releasing.md docs/documentation.md
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Run initial setup script
run: |
python initial_setup.py
- name: Regenerate uv.lock for the renamed project
run: uv lock
- name: Remove setup files
run: |
rm -f initial_setup.py
rm -f .github/workflows/initial-setup.yml
rm -f .github/workflows/template-ci.yml
rm -f .github/workflows/reusable-template-tests.yml
rm -f .github/FUNDING.yml
rm -rf tests/template
- name: Commit and push changes
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git commit -m "Initial repository setup completed by GitHub Actions"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}