diff --git a/template/.github/workflows/ci.yaml.jinja b/template/.github/workflows/ci.yaml.jinja index 78ec69b..1eb2a0e 100644 --- a/template/.github/workflows/ci.yaml.jinja +++ b/template/.github/workflows/ci.yaml.jinja @@ -77,7 +77,7 @@ jobs: path: {% endraw %}{{ app_name }}{% raw %}_app/.output/public/**/* if-no-files-found: error -{% endraw %}{% if use_staging_environment %}{% raw %} plan-to-staging: +{% endraw %}{% if use_staging_environment %}{% raw %} pulumi-staging: uses: ./.github/workflows/pulumi-aws.yml permissions: contents: write # needed for mutex @@ -96,9 +96,10 @@ jobs: DEPLOY_SCRIPT_NAME: pulumi_deploy PULUMI_PREVIEW: true PREVIEW_ROLE_NAME: InfraPreview--{% endraw %}{{ repo_name }}{% raw %} - PULUMI_UP: false + PULUMI_UP: ${{ github.ref == 'refs/heads/main' }} PULUMI_UP_ROLE_NAME: InfraDeploy--{% endraw %}{{ repo_name }}{% raw %} AWS_ACCOUNT_ID: "{% endraw %}{{ aws_staging_account_id }}{% raw %}" + SHOW_PREVIEW_COMMENT_ON_PR: ${{ github.event_name == 'pull_request' }} DOWNLOAD_ARTIFACT_NAME: app-frontend-static-assets DOWNLOAD_ARTIFACT_PATH: {% endraw %}{{ app_name }}{% raw %}_app/.output/public/{% endraw %}{% endif %}{% raw %} @@ -107,7 +108,8 @@ jobs: uses: ./.github/workflows/pulumi-aws.yml needs: - build-app-frontend - - check-skip-duplicate + - check-skip-duplicate{% endraw %}{% if use_staging_environment %}{% raw %} + - pulumi-staging{% endraw %}{% endif %}{% raw %} if: needs.check-skip-duplicate.outputs.should-run == 'true' && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || github.ref == 'refs/heads/main') permissions: id-token: write # needed to assume OIDC roles (e.g. for downloading from CodeArtifact) @@ -138,7 +140,7 @@ jobs: needs: - get-values - lint{% endraw %}{% if use_staging_environment %}{% raw %} - - plan-to-staging{% endraw %}{% endif %}{% raw %} + - pulumi-staging{% endraw %}{% endif %}{% raw %} - build-app-frontend - pulumi-prod - check-skip-duplicate @@ -155,7 +157,7 @@ jobs: [[ ! "${{ needs.check-skip-duplicate.result }}" =~ $success_pattern ]] || [[ ! "${{ needs.lint.result }}" =~ $success_pattern ]] || [[ ! "${{ needs.build-app-frontend.result }}" =~ $success_pattern ]] ||{% endraw %}{% if use_staging_environment %}{% raw %} - [[ ! "${{ needs.plan-to-staging.result }}" =~ $success_pattern ]] ||{% endraw %}{% endif %}{% raw %} + [[ ! "${{ needs.pulumi-staging.result }}" =~ $success_pattern ]] ||{% endraw %}{% endif %}{% raw %} [[ ! "${{ needs.pulumi-prod.result }}" =~ $success_pattern ]] || [[ ! "${{ needs.confirm-on-tagged-copier-template.result }}" =~ $success_pattern ]]; then echo "❌ One or more jobs did not finish with skipped or success"