Publish website only #70
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: Publish website only | |
on: | |
workflow_dispatch: | |
jobs: | |
publish_website: | |
runs-on: ubuntu-20.04 | |
environment: ${{ github.ref == 'refs/heads/main' && 'Development' || 'Production' }} | |
env: | |
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }} | |
AWS_SUBNET_PRIMARY: ${{ secrets.AWS_SUBNET_PRIMARY }} | |
AWS_ZONE_PRIMARY: ${{ secrets.AWS_ZONE_PRIMARY }} | |
AWS_SUBNET_SECONDARY0: ${{ secrets.AWS_SUBNET_SECONDARY0 }} | |
AWS_ZONE_SECONDARY0: ${{ secrets.AWS_ZONE_SECONDARY0 }} | |
AWS_SUBNET_SECONDARY1: ${{ secrets.AWS_SUBNET_SECONDARY1 }} | |
AWS_ZONE_SECONDARY1: ${{ secrets.AWS_ZONE_SECONDARY1 }} | |
AWS_SSH_KEY: ${{ secrets.AWS_SSH_KEY }} | |
GIT_REPOSITORY_URL: https://github.com/neu-dsg/dailp-encoding | |
OAUTH_TOKEN: ${{ secrets.OAUTH_TOKEN }} | |
RUST_LOG: info | |
# TODO When do we publish web content to UAT? | |
TF_STAGE: ${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: nixpkgs=channel:nixos-21.11 | |
- name: Use binary cache for nix store | |
uses: cachix/cachix-action@v12 | |
with: | |
name: dailp | |
# If you chose API tokens for write access OR if you have a private cache | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
pushFilter: "(-dailp$|-dailp-|-terraform-config$|-source$|\\.tar\\.gz$|-output$|-plan$|-apply-now$|-apply$)" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Build and test project | |
# nix -L argument shows the full build log and --impure allows it to access environment variables. | |
run: | | |
nix build --impure -L | |
cp -f ./result/config.tf.json ./config.tf.json | |
- name: Publish website | |
run: | | |
nix run --impure -L .#tf-plan | |
curl -X POST -d {} "$(nix run --impure .#tf-output amplify_webhook)" -H "Content-Type:application/json" |