Repository navigation
Add .python-version with the minimum supported Python version
#24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Demo | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| TEMPLATE: cookiecutter-python-cli-app | |
| CURRENT_DEMO: cookiecutter-python-cli-app-demo-current | |
| DEMO: cookiecutter-python-cli-app-demo | |
| jobs: | |
| update_demo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout ${{ env.TEMPLATE }} | |
| uses: actions/checkout@v7 | |
| with: | |
| path: ${{ env.TEMPLATE }} | |
| - name: Checkout ${{ env.DEMO }} | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: "sgraaf/${{ env.DEMO }}" | |
| token: ${{ secrets.X_GITHUB_PAT }} | |
| path: ${{ env.CURRENT_DEMO }} | |
| - name: Install the latest version of uv with caching enabled | |
| id: setup-uv | |
| uses: astral-sh/setup-uv@v10.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Build Demo | |
| run: | | |
| cat "${{ env.TEMPLATE }}/.github/workflows/input-for-demo.txt" | uvx cookiecutter "${{ env.TEMPLATE }}" | |
| find "${{ env.DEMO }}" | |
| - name: Commit and push changes | |
| run: | | |
| # Sync the generated files into the checkout rather than moving `.git`: `actions/checkout` persists the | |
| # credentials via an `includeIf "gitdir:..."` entry, which no longer matches once `.git` has been moved | |
| rsync -a --delete --exclude .git "${{ env.DEMO }}/" "${{ env.CURRENT_DEMO }}/" | |
| cd "${{ env.CURRENT_DEMO }}" | |
| git config user.name "Automated" | |
| git config user.email "actions@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Demo of ${{ env.TEMPLATE }} @ ${GITHUB_SHA::7}" || exit 0 | |
| git push | |
| - name: Post commit comment | |
| run: | | |
| export FULL_SHA=$(git rev-parse HEAD) | |
| echo '{}' | \ | |
| jq --arg v "Demo: https://github.com/sgraaf/${{ env.DEMO }}/tree/${FULL_SHA::7}" '. + { body: $v }' | \ | |
| curl -sL \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments" \ | |
| -d @- | |
| working-directory: ${{ env.CURRENT_DEMO }} |