From 5e4d5c82d818d4c722e034027137d7cdcb5229b8 Mon Sep 17 00:00:00 2001 From: CC Date: Thu, 21 May 2026 17:03:36 +0100 Subject: [PATCH] ci/cd on push test --- .gitea/workflows/deploy.yml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4c2f6a3..c192c91 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -23,11 +23,12 @@ jobs: - name: Check files & Select tfvars shell: bash run: | - pwd mkdir -p ansible/inventory + rm ansible/inventory/inventory.yml + cd terraform + rm vm_data.yml cp "${{ inputs.tfvars_file || 'single.tfvars.example' }}" terraform.tfvars - ls - uses: hashicorp/setup-terraform@v4 @@ -42,20 +43,6 @@ jobs: run: terraform apply -auto-approve working-directory: "terraform" - - name: Configure Git - run: | - git config user.name "git-bot" - git config user.email "got-bot@text.com" - - - name: Commit and push to Gitea - run: | - git remote set-url origin https://$GITEA_USERNAME:${{ secrets.GIT_BOT_TOKEN }}@tea.charcarservices.uk/CC/N8N.git - git add terraform/vm_data.yml ansible/inventory/inventory.yml - git diff --cached --quiet || git commit -m "chore: update terraform outputs" - git push origin HEAD:main - env: - GITEA_USERNAME: git-bot # or your bot account - - name: Install Ansible shell: bash run: | @@ -69,12 +56,24 @@ jobs: chmod 600 ~/.ssh/id_rsa echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n" > ~/.ssh/config - - name: Setup Ansible Directories + - name: Ansible Inventory YML run: | - pwd cat ansible/inventory/inventory.yml - ls -r - name: Run playbook run: | ansible-playbook ansible/playbooks/docker_copy.yml -i ansible/inventory/inventory.yml -u cloud --private-key ~/.ssh/id_rsa + + - name: Configure Git + run: | + git config user.name "git-bot" + git config user.email "got-bot@text.com" + + - name: Commit and push to Gitea + run: | + git remote set-url origin https://$GITEA_USERNAME:${{ secrets.GIT_BOT_TOKEN }}@tea.charcarservices.uk/CC/N8N.git + git add terraform/vm_data.yml ansible/inventory/inventory.yml + git diff --cached --quiet || git commit -m "chore: update terraform outputs" + git push origin HEAD:main + env: + GITEA_USERNAME: git-bot # or your bot account