Skip to content

.github/workflows/deploy.yml #17

.github/workflows/deploy.yml

.github/workflows/deploy.yml #17

Workflow file for this run

name: Deploy Pipeline
on:
schedule:
- cron: "45 22 * * 1-5" # 8:45 AM AEST
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check if deploy should run
if: vars.RUN_DEPLOY == 'true'
run: echo "Deploying..."
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2
- name: Install Node.js and npm
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
- name: Install zip (for Lambda build)
run: sudo apt-get install -y zip
- name: Create frontend .env.production
run: |
cat <<EOF > frontend/.env.production
VITE_ENV=${{ vars.VITE_ENV }}
VITE_API_URL=${{ vars.VITE_API_URL }}
VITE_ASSETS_URL=${{ vars.VITE_ASSETS_URL }}
EOF
# - name: Create terraform.tfvars
# run: |
# cat <<EOF > devops/terraform.tfvars
# ${{ secrets.TERRAFORM_VARIABLES }}
# EOF
- name: Run deploy script
env:
TF_VAR_aws_region: ${{ vars.TF_VAR_AWS_REGION }}
TF_VAR_region_id: ${{ vars.TF_VAR_REGION_ID }}
TF_VAR_aza: ${{ vars.TF_VAR_AZA }}
TF_VAR_azb: ${{ vars.TF_VAR_AZB }}
TF_VAR_ecs_image_url: ${{ vars.TF_VAR_ECS_IMAGE_URL }}
TF_VAR_hosted_zone_id: ${{ secrets.TF_VAR_HOSTED_ZONE_ID }}
TF_VAR_acm_certificate_arn: ${{ secrets.TF_VAR_ACM_CERTIFICATE_ARN }}
TF_VAR_db_username: ${{ secrets.TF_VAR_DB_USERNAME }}
TF_VAR_db_password: ${{ secrets.TF_VAR_DB_PASSWORD }}
TF_VAR_vpc_id: ${{ secrets.TF_VAR_VPC_ID }}
TF_VAR_public_route_table_id: ${{ secrets.TF_VAR_PUBLIC_ROUTE_TABLE_ID }}
run: |
cd ./devops
chmod +x deploy.sh
./deploy.sh