feat(actions): pulumi preview job and pulumi up job shared plan #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy IaC with Pulumi | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
pulumi-preview: | |
permissions: | |
id-token: write | |
contents: read | |
name: Pulumi Preview 📄 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/auth@v2 | |
with: | |
project_id: ${{ vars.GCP_PROJECT_ID }} | |
workload_identity_provider: projects/491900032446/locations/global/workloadIdentityPools/github-pool/providers/my-repo | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
- name: Preview infra | |
uses: pulumi/actions@v5 | |
with: | |
command: preview | |
stack-name: ${{ vars.PULUMI_ORG }}/${{ vars.PULUMI_STACK }} | |
plan: pulumi_plan.json | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
- name: Save preview plan 💾 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pulumi_plan.json | |
path: ${{ github.workspace }}/pulumi_plan.json | |
pulumi-up: | |
needs: pulumi-preview | |
permissions: | |
id-token: write | |
contents: read | |
name: Pulumi Update 🚀 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/auth@v2 | |
with: | |
project_id: ${{ vars.GCP_PROJECT_ID }} | |
workload_identity_provider: projects/491900032446/locations/global/workloadIdentityPools/github-pool/providers/my-repo | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt | |
- name: Get Pulumi plan ⬇️ | |
uses: actions/download-artifact@v4 | |
with: | |
name: pulumi_plan.json | |
- name: Update infra | |
uses: pulumi/actions@v5 | |
with: | |
command: update | |
stack-name: ${{ vars.PULUMI_ORG }}/${{ vars.PULUMI_STACK }} | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |