Skip to content

Commit

Permalink
Update aws_deploy_hydroserver.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kjlippold authored Feb 26, 2024
1 parent f412679 commit edc7cd8
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/aws_deploy_hydroserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ on:
environment:
description: 'Enter a deployment environment name.'
required: true
version:
description: 'Choose a release tag to deploy, or leave blank to use the latest version.'
hydroserver-version:
description: 'Enter a version of HydroServer to use. Leave blank to use the latest version.'
required: false
enable_timescale:
description: 'Enable TimescaleDB. ('
required: true
default: true
# Setting `type` to `boolean` makes the input a boolean type
type: boolean

jobs:
deploy-backend:
name: Deploy Backend
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout backend repo
- name: Get Latest HydroServer Version
id: get_latest_tag
run: echo "tag=$(curl -sL https://api.github.com/repos/hydroserver2/hydroserver-webapp-back/releases/latest | jq -r '.tag_name')" >> $GITHUB_OUTPUT

- name: Checkout Backend Repo
uses: actions/checkout@v4
with:
repository: hydroserver2/hydroserver-webapp-back
ref: refs/tags/${{ github.event.inputs.version || '$(curl -sL https://api.github.com/repos/hydroserver2/hydroserver-webapp-back/releases/latest | jq -r ".tag_name")' }}
ref: refs/tags/${{ github.event.inputs.hydroserver-version || steps.get_latest_tag.outputs.tag }}
path: backend

- name: Configure AWS Credentials
Expand All @@ -36,11 +34,11 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'

- name: Create backend deployment package
- name: Create Backend Deployment Package
working-directory: ./backend
run: zip -r deploy_package.zip ./

- name: Upload deployment package to S3
- name: Upload Deployment Package to S3
working-directory: ./backend
run: aws s3 cp deploy_package.zip s3://hydroserver-${{ github.event.inputs.environment }}-backend/deploy_package_${{ github.event.inputs.version }}.zip

Expand Down Expand Up @@ -155,11 +153,15 @@ jobs:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout frontend repo
- name: Get Latest HydroServer Version
id: get_latest_tag
run: echo "tag=$(curl -sL https://api.github.com/repos/hydroserver2/hydroserver-webapp-front/releases/latest | jq -r '.tag_name')" >> $GITHUB_OUTPUT

- name: Checkout Frontend Repo
uses: actions/checkout@v4
with:
repository: hydroserver2/hydroserver-webapp-front
ref: refs/tags/${{ github.event.inputs.version || '$(curl -sL https://api.github.com/repos/hydroserver2/hydroserver-webapp-front/releases/latest | jq -r ".tag_name")' }}
ref: refs/tags/${{ github.event.inputs.hydroserver-version || steps.get_latest_tag.outputs.tag }}
path: frontend

- name: Configure AWS Credentials
Expand All @@ -176,7 +178,7 @@ jobs:
cache: npm
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
- name: Install Dependencies
working-directory: ./frontend
run: npm ci

Expand All @@ -190,7 +192,7 @@ jobs:
VITE_APP_PROXY_BASE_URL=${{ secrets.PROXY_BASE_URL }}
EOF
- name: Build frontend
- name: Build Frontend
working-directory: ./frontend
run: npm run build

Expand All @@ -199,6 +201,6 @@ jobs:
run: |
aws s3 sync ./dist s3://hydroserver-${{ github.event.inputs.environment }}-web/ --delete
- name: Invalidate CloudFront distribution cache
- name: Invalidate CloudFront Distribution Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_ID }} --paths "/*"

0 comments on commit edc7cd8

Please sign in to comment.