diff --git a/.github/workflows/trigger-template-update.yml b/.github/workflows/trigger-template-update.yml new file mode 100644 index 0000000..4fdf5b2 --- /dev/null +++ b/.github/workflows/trigger-template-update.yml @@ -0,0 +1,73 @@ +name: Update Child Repository Template + +on: + release: + types: [published] + workflow_dispatch: + inputs: + target_repository: + description: "Target repository to update (default: mjun0812/python-project-template)" + required: false + default: "mjun0812/python-project-template" + +jobs: + update-child-template: + runs-on: ubuntu-latest + steps: + - name: Checkout child repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.inputs.target_repository || 'mjun0812/python-project-template' }} + token: ${{ secrets.CHILD_REPO_TOKEN }} + path: child-repo + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Update template in child repository + working-directory: child-repo + run: | + # Update from template + uvx copier update -A --trust + + - name: Check for changes + id: changes + working-directory: child-repo + run: | + if git diff --quiet; then + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo "has_changes=true" >> $GITHUB_OUTPUT + fi + + - name: Create Pull Request + if: steps.changes.outputs.has_changes == 'true' + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.CHILD_REPO_TOKEN }} + path: child-repo + commit-message: | + Update template to version ${{ github.event.release.tag_name || 'latest' }} + title: "Update template to version ${{ github.event.release.tag_name || 'latest' }}" + body: | + ## Template Update + + This PR updates the project template to version `${{ github.event.release.tag_name || 'latest' }}`. + + ### Changes + - Updated from template: ${{ github.repository }} + - Template version: ${{ github.event.release.tag_name || 'latest' }} + ${{ github.event.release.html_url && format('- Release notes: {0}', github.event.release.html_url) || '' }} + + ### Testing + Please review the changes and test the updated template before merging. + + --- + *This PR was automatically created by the template update workflow.* + branch: template-update-${{ github.event.release.tag_name || github.run_number }} + delete-branch: true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d1885f6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Junya Morioka + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 0d5ff5e..94416b0 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A simple modern Python project template powered by [Copier](https://copier.readt ### Generate a New Project ```bash -uvx copier copy https://github.com/mjun0812/python-copier-template your-project-name +uvx copier copy gh:mjun0812/python-copier-template your-project-name ``` Follow the interactive prompts to configure your project: @@ -63,7 +63,7 @@ uv run ruff check . uv run ruff check . --fix ``` -## Docker Development +### Docker Development Setup The template includes a complete Docker setup: @@ -84,6 +84,13 @@ docker compose up Open the project in VS Code and use the "Reopen in Container" command for a fully configured development environment. +### Update Template + +```bash +cd your-project-name +uvx copier update -A +``` + ## Project Structure ```text