simplify ci
This commit is contained in:
1 parent
e4f6dbabe1
commit
7b91252a7c
1 file changed
+4
-40
@@ -10,7 +10,7 @@ env:
|
||||
TERRAFORM_VERSION: "1.10.5"
|
||||
|
||||
jobs:
|
||||
plan:
|
||||
terraform:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -48,46 +48,10 @@ jobs:
|
||||
BUNNYNET_API_KEY: ${{ secrets.BUNNYNET_API_KEY }}
|
||||
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}
|
||||
run: terraform plan -out=tfplan
|
||||
|
||||
- name: Upload plan artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tfplan-${{ matrix.environment }}
|
||||
path: ${{ matrix.environment }}/tfplan
|
||||
retention-days: 1
|
||||
|
||||
apply:
|
||||
needs: plan
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
environment: ["git.rznet.fr", "mirror.rznet.fr"]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v3
|
||||
with:
|
||||
terraform_version: ${{ env.TERRAFORM_VERSION }}
|
||||
|
||||
- name: Download plan artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: tfplan-${{ matrix.environment }}
|
||||
path: ${{ matrix.environment }}
|
||||
|
||||
- name: Terraform init
|
||||
working-directory: ${{ matrix.environment }}
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
run: terraform init -upgrade
|
||||
run: terraform plan
|
||||
|
||||
- name: Terraform apply
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
working-directory: ${{ matrix.environment }}
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
@@ -95,4 +59,4 @@ jobs:
|
||||
BUNNYNET_API_KEY: ${{ secrets.BUNNYNET_API_KEY }}
|
||||
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
|
||||
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}
|
||||
run: terraform apply -auto-approve tfplan
|
||||
run: terraform apply -auto-approve
|
||||
Reference in new issue
Block a user