1
+ name : Pulumi Only - Deploy Infra
2
+ run-name : Run pulumi - ${{github.event.inputs.command || 'review'}} - ${{ github.event.inputs.environment || 'review' }}
3
+
4
+ on :
5
+ workflow_dispatch :
6
+ inputs :
7
+ commit :
8
+ description : " Leave blank to use current HEAD, or provide an override commit SHA"
9
+ type : string
10
+ required : false
11
+ environment :
12
+ description : " Environment to deploy to"
13
+ required : false
14
+ default : " review"
15
+ type : choice
16
+ options :
17
+ - review
18
+ - staging
19
+ - production
20
+ command :
21
+ description : " Pulumi command to run"
22
+ required : false
23
+ default : " preview"
24
+ type : choice
25
+ options :
26
+ - preview
27
+ - up
28
+ - refresh
29
+ jobs :
30
+ ref :
31
+ name : Load Commit Ref
32
+ runs-on : ubuntu-latest
33
+ steps :
34
+ - id : ref
35
+ uses : passportxyz/gh-workflows/.github/actions/load_commit_ref@v3
36
+ with :
37
+ commit : ${{ inputs.commit }}
38
+
39
+ outputs :
40
+ version_tag : ${{ steps.ref.outputs.version_tag }}
41
+ docker_tag : ${{ steps.ref.outputs.docker_tag }}
42
+ refspec : ${{ steps.ref.outputs.refspec }}
43
+
44
+ run_pulumi :
45
+ name : Run Pulumi
46
+ needs : [ref]
47
+ runs-on : ubuntu-latest
48
+ steps :
49
+ - name : Checkout
50
+ uses : actions/checkout@v3
51
+ with :
52
+ ref : ${{ inputs.refspec }}
53
+ fetch-depth : 0
54
+ - name : Install 1Password CLI
55
+ uses : 1password/install-cli-action@v1
56
+ - name : Configure 1Password Service Account
57
+ uses : 1password/load-secrets-action/configure@v1
58
+ with :
59
+ service-account-token : ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
60
+ - name : Load secret
61
+ id : op-load-secret
62
+ uses : 1password/load-secrets-action@v1
63
+ with :
64
+ export-env : true
65
+ env :
66
+ CLOUDFLARE_API_TOKEN : op://DevOps/passport-xyz-${{ inputs.environment }}-secrets/ci/CLOUDFLARE_API_TOKEN
67
+ AWS_ACCESS_KEY_ID : op://DeployerVault/github-aws-${{ inputs.environment }}/ci/AWS_ACCESS_KEY_ID
68
+ AWS_SECRET_ACCESS_KEY : op://DeployerVault/github-aws-${{ inputs.environment }}/ci/AWS_SECRET_ACCESS_KEY
69
+ PULUMI_ACCESS_TOKEN : op://DeployerVault/github-aws-${{ inputs.environment }}/ci/PULUMI_ACCESS_TOKEN
70
+
71
+ - name : Set AWS_SESSION_TOKEN if needed
72
+ if : inputs.environment == 'production'
73
+ run : echo "AWS_SESSION_TOKEN=$(op read op://DeployerVault/github-aws-production/ci/AWS_SESSION_TOKEN)" >> $GITHUB_ENV
74
+
75
+ - name : Yarn install
76
+ uses : passportxyz/gh-workflows/.github/actions/prepare_deploy_to_aws@v3
77
+ - name : Run pulumi
78
+ uses : passportxyz/gh-workflows/.github/actions/deploy_to_aws@v3
79
+ with :
80
+ docker_tag : ${{ inputs.docker_tag }}
81
+ stack_name : passportxyz/passport/${{ inputs.environment }}
82
+ aws_region : us-west-2
83
+ pulumi_command : ${{ github.event.inputs.command || 'preview' }}
84
+ pulumi_diff : true
85
+ AWS_ACCESS_KEY_ID : ${{ env.AWS_ACCESS_KEY_ID }}
86
+ AWS_SECRET_ACCESS_KEY : ${{ env.AWS_SECRET_ACCESS_KEY }}
87
+ PULUMI_ACCESS_TOKEN : ${{ env.PULUMI_ACCESS_TOKEN }}
88
+ OP_SERVICE_ACCOUNT_TOKEN : ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
89
+ CLOUDFLARE_API_TOKEN : ${{ env.CLOUDFLARE_API_TOKEN }}
0 commit comments