Font for prices #491
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 Square Instagram Integration | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
push: | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
test-image-code: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ vars.cicd_role_arn }} | |
aws-region: ${{ vars.aws_region }} | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependancies | |
working-directory: image | |
run: | | |
python -m pip install --upgrade pip pytest | |
pip install -r requirements.txt | |
- name: Run pytest | |
working-directory: image | |
env: | |
# TODO: These should not be hardcoded as they are outputs from terraform | |
square_token_arn: "arn:aws:secretsmanager:us-east-1:015140017687:secret:square_token-oMlH85" | |
gh_key_arn: "arn:aws:secretsmanager:us-east-1:015140017687:secret:github-rM9oxz" | |
instructions_git_repo: "git@github.com:stuart23/plantsoc.com.git" | |
run: python3 -m pytest | |
deploy-square-ig: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'true' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ vars.cicd_role_arn }} | |
aws-region: ${{ vars.aws_region }} | |
- name: 'Authenticate to GCP' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
# project_id: ${{ vars.gcp_project }} | |
workload_identity_provider: ${{ vars.gcp_workload_identity_provider }} | |
service_account: ${{ vars.cicd_service_account }} | |
create_credentials_file: true | |
export_environment_variables: true | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Init ECR | |
working-directory: ecr | |
run: terraform init | |
- name: Terraform Apply ECR | |
working-directory: ecr | |
run: terraform apply -auto-approve -var aws_region=${{ vars.aws_region }} | |
- name: Get ECR URL | |
working-directory: ecr | |
run: echo "ECR_REPO_URL=$(terraform output -raw ecr_repo_url)" >> $GITHUB_ENV | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
# REMOVE THIS | |
with: | |
mask-password: 'false' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.ECR_REPO_URL }} | |
- name: Build and push | |
id: image-build | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/arm64 | |
context: "image" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: false | |
- name: Echo Image ID | |
run: echo ${{ env.ECR_REPO_URL }}@${{ steps.image-build.outputs.digest }} | |
- name: Get Google Drive ID | |
env: | |
drive_name: ${{ vars.drive_name }} | |
id: google_drive_id | |
run: | | |
pip3 install google-api-python-client | |
python3 tools/get_google_drive_id.py >> $GITHUB_OUTPUT | |
- name: Echo Google Drive ID | |
run: echo ${{ steps.google_drive_id.outputs.drive_id }} | |
- name: Terraform Init Square Webhooks | |
working-directory: square_webhooks | |
run: terraform init | |
- name: Terraform Apply Square Webhooks | |
working-directory: square_webhooks | |
run: | | |
terraform apply -auto-approve \ | |
-var lambda_image="${{ env.ECR_REPO_URL }}@${{ steps.image-build.outputs.digest }}" \ | |
-var aws_region=${{ vars.aws_region }} \ | |
-var square_token="${{ secrets.square_token }}" \ | |
-var gh_key_arn="${{ vars.gh_key_arn }}" \ | |
-var instructions_git_repo="${{ vars.instructions_git_repo }}" \ | |
-var labels_google_drive_id="${{ steps.google_drive_id.outputs.drive_id }}" | |
deploy-static-website: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ vars.cicd_role_arn }} | |
aws-region: ${{ vars.aws_region }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Init | |
working-directory: static_website | |
run: terraform init | |
- name: Terraform Apply | |
working-directory: static_website | |
run: | | |
terraform apply -auto-approve \ | |
-var domain_name="theplantsocietyatx.com" \ | |
-var porkbun_api_key="${{ secrets.porkbun_api_key }}" \ | |
-var porkbun_secret_key="${{ secrets.porkbun_secret_key }}" \ | |
-var aws_region=${{ vars.aws_region }} | |
deploy-instructions-website: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ vars.cicd_role_arn }} | |
aws-region: ${{ vars.aws_region }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Init | |
working-directory: instructions_website | |
run: terraform init | |
- name: Terraform Apply | |
working-directory: instructions_website | |
run: | | |
terraform apply -auto-approve \ | |
-var domain_name="plantsoc.com" \ | |
-var porkbun_api_key="${{ secrets.porkbun_api_key }}" \ | |
-var porkbun_secret_key="${{ secrets.porkbun_secret_key }}" \ | |
-var aws_region=${{ vars.aws_region }} |