40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
name: CI/CD Pipeline
|
|
run-name: ${{ gitea.event.head_commit.message }}
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
test:
|
|
runs-on: debian-latest
|
|
steps:
|
|
- name: Show Debian version
|
|
run: cat /etc/os-release
|
|
- name: Test Deployment
|
|
run: echo "Deployment test"
|
|
|
|
deploy:
|
|
runs-on: self-hosted
|
|
needs: test
|
|
steps:
|
|
- name: Custom Checkout
|
|
env:
|
|
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
|
|
ANSIBLE_POSIX_ACL: false
|
|
run: |
|
|
git clone --quiet --no-checkout --depth=1 --branch=${{ gitea.ref_name }} ${{ vars.SPEEDBB_REPO }} ./repo
|
|
cd repo
|
|
git config core.sparseCheckout true
|
|
echo "ansible/" > .git/info/sparse-checkout
|
|
git checkout HEAD
|
|
ls -la
|
|
cd ansible
|
|
pwd
|
|
ls -la
|
|
cat hosts.ini
|
|
echo "$ANSIBLE_VAULT_PASSWORD" > .vault_pass.txt
|
|
echo "=== Vault contents ==="
|
|
ansible-vault view --vault-password-file .vault_pass.txt vars/vault.yaml
|
|
echo "=== End vault contents ==="
|
|
ansible-playbook --vault-password-file .vault_pass.txt deploy-to-prod.yaml
|
|
rm .vault_pass.txt |