should result in different app zip checksums #139
Workflow file for this run
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: Run Terraform plan in staging | |
on: | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
terraform: | |
name: Terraform plan | |
runs-on: ubuntu-24.04 | |
environment: staging | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: terraform validate | |
uses: dflook/terraform-validate@v1 | |
with: | |
path: terraform | |
- name: terraform fmt | |
uses: dflook/terraform-fmt-check@v1 | |
with: | |
path: terraform | |
- uses: ./.github/actions/setup-languages | |
- name: Asset cache | |
uses: actions/cache@v4 | |
with: | |
key: staging-assets-build-${{ github.sha }} | |
restore-keys: staging-assets-deployed- | |
path: | | |
public/assets | |
app/assets/builds | |
app/javascript/generated | |
- name: Precompile assets and clean old versions | |
env: | |
RAILS_ENV: staging | |
SECRET_KEY_BASE_DUMMY: 1 | |
run: ./bin/rake assets:precompile && ./bin/rake assets:clean | |
- name: terraform plan | |
uses: dflook/terraform-plan@v1 | |
env: | |
TF_VAR_cf_user: ${{ secrets.CF_USERNAME }} | |
TF_VAR_cf_password: ${{ secrets.CF_PASSWORD }} | |
TF_VAR_rails_master_key: ${{ secrets.RAILS_MASTER_KEY }} | |
TERRAFORM_PRE_RUN: | | |
apt-get update | |
apt-get install -y zip | |
with: | |
path: terraform | |
var_file: terraform/staging.tfvars | |
add_github_comment: always-new | |
backend_config: > | |
access_key=${{ secrets.TERRAFORM_STATE_ACCESS_KEY }} | |
secret_key=${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }} | |
bucket=${{ secrets.TERRAFORM_STATE_BUCKET_NAME }} | |
key=terraform.tfstate.staging | |
- name: Save app zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zip-with-precompile | |
path: terraform/dist/src.zip | |
compression-level: 0 | |
overwrite: true | |
retention-days: 2 | |
if-no-files-found: error | |
recompile: | |
needs: terraform | |
runs-on: ubuntu-24.04 | |
environment: staging | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore asset cache | |
uses: actions/cache/restore@v4 | |
with: | |
key: staging-assets-build-${{ github.sha }} | |
fail-on-cache-miss: true | |
path: | | |
public/assets | |
app/assets/builds | |
app/javascript/generated | |
- name: terraform plan | |
uses: dflook/terraform-plan@v1 | |
env: | |
TF_VAR_cf_user: ${{ secrets.CF_USERNAME }} | |
TF_VAR_cf_password: ${{ secrets.CF_PASSWORD }} | |
TF_VAR_rails_master_key: ${{ secrets.RAILS_MASTER_KEY }} | |
TERRAFORM_PRE_RUN: | | |
apt-get update | |
apt-get install -y zip | |
with: | |
path: terraform | |
var_file: terraform/staging.tfvars | |
add_github_comment: always-new | |
backend_config: > | |
access_key=${{ secrets.TERRAFORM_STATE_ACCESS_KEY }} | |
secret_key=${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }} | |
bucket=${{ secrets.TERRAFORM_STATE_BUCKET_NAME }} | |
key=terraform.tfstate.staging | |
- name: Save deployed assets cache | |
uses: actions/cache/save@v4 | |
with: | |
key: staging-assets-deployed-${{ github.sha }} | |
path: | | |
public/assets | |
app/assets/builds | |
app/javascript/generated | |
- name: Save app zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zip-with-cache | |
path: terraform/dist/src.zip | |
compression-level: 0 | |
overwrite: true | |
retention-days: 2 | |
if-no-files-found: error |