Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ publish_to_pypi:
default: False
when: "{{ enable_github_action }}"

enable_deploy:
type: bool
default: False
when: "{{ enable_github_action }}"
help: Add a manual deploy workflow using the trobz/deploy.py action

############# Tasks ##################
_tasks:
- "ln -sf AGENTS.md CLAUDE.md"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy

on:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: deploy
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check deploy secrets
env:
DEPLOY_SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }}
DEPLOY_SSH_USER: ${{ secrets.DEPLOY_SSH_USER }}
DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
DEPLOY_INSTANCE: ${{ secrets.DEPLOY_INSTANCE }}
run: |
missing=()
for v in DEPLOY_SSH_HOST DEPLOY_SSH_USER DEPLOY_SSH_PRIVATE_KEY DEPLOY_INSTANCE; do
[[ -n "${!v}" ]] || missing+=("$v")
done
if (( ${#missing[@]} )); then
echo "::error::Deploy is not configured. Missing secrets: ${missing[*]}. See https://github.com/trobz/trobz-python-template/blob/main/docs/deployment-guide.md" >&2
exit 1
fi

- name: Deploy
uses: trobz/deploy.py@v0.23.1 # TODO: bump to the Phase 1 tag once trobz/deploy.py#47 merges and releases
with:
deploy_ssh_host: ${{ secrets.DEPLOY_SSH_HOST }}
deploy_ssh_port: ${{ secrets.DEPLOY_SSH_PORT || '22' }}
deploy_ssh_user: ${{ secrets.DEPLOY_SSH_USER }}
deploy_ssh_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
deploy_instance: ${{ secrets.DEPLOY_INSTANCE }}
deploy_type: python
deploy_repo_branch: ${{ github.ref_name }}

- name: Summary
env:
REF: ${{ github.ref_name }}
SHA: ${{ github.sha }}
run: |
echo "Deployed \`$REF\` @ \`$SHA\`" >> "$GITHUB_STEP_SUMMARY"