|
| 1 | +name: quix-aks module CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, dev ] |
| 6 | + paths: |
| 7 | + - 'modules/quix-aks/**' |
| 8 | + - '.github/workflows/terraform-module.yml' |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + bump: |
| 12 | + description: 'Version bump (patch, minor, major)' |
| 13 | + required: true |
| 14 | + default: 'minor' |
| 15 | + type: choice |
| 16 | + options: [patch, minor, major] |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: write |
| 20 | + |
| 21 | +jobs: |
| 22 | + validate: |
| 23 | + name: Validate Terraform |
| 24 | + runs-on: ubuntu-latest |
| 25 | + defaults: |
| 26 | + run: |
| 27 | + working-directory: modules/quix-aks |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - name: Setup Terraform |
| 35 | + uses: hashicorp/setup-terraform@v3 |
| 36 | + with: |
| 37 | + terraform_version: 1.6.6 |
| 38 | + |
| 39 | + - name: Terraform fmt |
| 40 | + run: terraform fmt -check -recursive |
| 41 | + |
| 42 | + - name: Terraform init (no backend) |
| 43 | + run: terraform init -backend=false |
| 44 | + |
| 45 | + - name: Terraform validate |
| 46 | + run: terraform validate |
| 47 | + |
| 48 | + - name: Generate terraform-docs (inject & commit) |
| 49 | + uses: terraform-docs/[email protected] |
| 50 | + with: |
| 51 | + working-dir: modules/quix-aks |
| 52 | + output-file: README.md |
| 53 | + output-method: inject |
| 54 | + config-file: '' |
| 55 | + git-push: true |
| 56 | + |
| 57 | + release: |
| 58 | + name: Tag release |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: validate |
| 61 | + # Only release on manual dispatch with bump==minor |
| 62 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.bump == 'minor' }} |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + |
| 69 | + - name: Create tag (SemVer bump) |
| 70 | + id: tag |
| 71 | + uses: anothrNick/[email protected] |
| 72 | + env: |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + DEFAULT_BUMP: ${{ github.event.inputs.bump }} |
| 75 | + TAG_PREFIX: 'v' |
| 76 | + |
| 77 | + - name: Create GitHub Release |
| 78 | + uses: softprops/action-gh-release@v2 |
| 79 | + if: steps.tag.outputs.new_tag != '' |
| 80 | + with: |
| 81 | + tag_name: ${{ steps.tag.outputs.new_tag }} |
| 82 | + name: ${{ steps.tag.outputs.new_tag }} |
| 83 | + generate_release_notes: true |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments