Merge pull request #109 from GSA-TTS/dependency-updates #88
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 Staging | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- 'doc/**' | |
- 'README.md' | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
build-assets: | |
name: Compile and clean assets | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile assets | |
uses: ./.github/actions/compile-assets | |
with: | |
rails_env: staging | |
save_cache: true | |
- name: Upload assets | |
uses: actions/upload-artifact@v4 | |
with: | |
name: staging-assets | |
path: public/assets | |
deploy: | |
name: Deploy to staging | |
runs-on: ubuntu-latest | |
needs: build-assets | |
environment: staging | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
name: staging-assets | |
path: public/assets | |
- name: Terraform apply | |
uses: dflook/terraform-apply@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 | |
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 for debugging | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-src-apply | |
path: terraform/dist/src.zip | |
compression-level: 0 | |
retention-days: 1 |