diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/ci-cd.yml similarity index 69% rename from .gitea/workflows/deploy.yml rename to .gitea/workflows/ci-cd.yml index 13a49ca..f68217f 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/ci-cd.yml @@ -1,8 +1,8 @@ -name: Deploy Minecraft Server +name: Ansible Lint on: push: - branches: [ main ] + branches: [ main, develop ] workflow_dispatch: inputs: environment: @@ -13,8 +13,36 @@ on: options: - staging - production + pull_request: + branches: [ main ] jobs: + ansible_lint_and_syntax_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + pip install ansible ansible-lint yamllint + + - name: Run yamllint + run: yamllint . + + - name: Run ansible-lint + run: ansible-lint + continue-on-error: true + + - name: Validate inventory files + run: | + ansible-inventory --list -i inventories/production/hosts.yml + ansible-inventory --list -i inventories/staging/hosts.yml + deploy: runs-on: ubuntu-latest environment: ${{ github.event.inputs.environment || 'staging' }} diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml deleted file mode 100644 index ed77302..0000000 --- a/.gitea/workflows/lint.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Ansible Lint - -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main ] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - - name: Install dependencies - run: | - pip install ansible ansible-lint yamllint - - - name: Run yamllint - run: yamllint . - - - name: Run ansible-lint - run: ansible-lint - - - name: Validate inventory files - run: | - ansible-inventory --list -i inventories/production/hosts.yml - ansible-inventory --list -i inventories/staging/hosts.yml \ No newline at end of file