From 06e085fb6d6530e04a695fd6a2e4895190fa6907 Mon Sep 17 00:00:00 2001 From: gov Date: Tue, 4 Aug 2026 12:43:02 -0400 Subject: [PATCH] chore(cd): gitea autodeploy on push to main --- .gitea/workflows/deploy.yml | 49 +++++++++++++++++++++++++++++++++++++ README.md | 30 +++++++++++++++++++++-- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..c2ceb51 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,49 @@ +name: Deploy PDS + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Ansible + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq ansible + + - name: Write SSH key + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -H ${{ vars.SERVER_IP }} >> ~/.ssh/known_hosts + + - name: Generate inventory + run: | + cat > inventory.yml < vars/main.yml < Actions): + +**Variables** (non-sensitive config): + +| Variable | Description | +|---|---| +| `SERVER_IP` | Target server IP address | +| `PDS_HOSTNAME` | Public DNS name for the PDS (e.g., `pds.example.com`) | +| `PDS_ADMIN_EMAIL` | Admin contact email | + +**Secrets** (sensitive credentials): + +| Secret | Description | +|---|---| +| `SSH_PRIVATE_KEY` | Private SSH key for the `sysadmin` user on the target server | +| `OVH_S3_ACCESS_KEY` | OVH S3 access key for blob storage | +| `OVH_S3_SECRET_KEY` | OVH S3 secret key for blob storage | + +The workflow installs Ansible, writes the SSH key from a secret, generates `inventory.yml` and `vars/main.yml` from vars and secrets, and runs the playbook.