Last active
January 5, 2023 18:01
-
-
Save dsiddharth/8c1625475f944eec749feff4a88eaa15 to your computer and use it in GitHub Desktop.
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
server: | |
name: Build and deploy server | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Install Hathora CLI | |
run: npm install -g hathora | |
- name: Deploy server to Hathora Cloud | |
run: hathora cloud deploy --appName ${{ secrets.HATHORA_APP_NAME }} --token ${{ secrets.HATHORA_TOKEN }} | |
client: | |
name: Build and deploy client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Install Hathora CLI | |
run: npm install -g hathora | |
- name: Build client | |
run: APP_ID=${{ secrets.HATHORA_APP_ID }} hathora build --only client | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_S3_REGION }} | |
- name: Upload client to S3 | |
run: aws s3 sync client/web/dist s3://${{ secrets.AWS_S3_BUCKET }} --delete | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }} --paths "/*" --region ${{ secrets.AWS_CLOUDFRONT_REGION }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment