Skip to content

Commit

Permalink
Auto publish master
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Mar 18, 2024
1 parent fb8c926 commit e1e7e2a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish

on:
workflow_dispatch:
push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup prod dependencies
run: yarn install
- name: Deploy infrastructure
uses: serverless/github-action@v3
with:
args: deploy --stage prod --verbose
env:
AWS_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DOMAIN_ZONE: ${{ secrets.APP_DOMAIN_HOSTED_ZONE }}
DOMAIN_NAME: horde-ng.org
- name: Build app
run: ./node_modules/.bin/ng build
- name: Copy files to S3
env:
STACK_NAME: HordeNG-prod
AWS_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
BUCKET=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='Bucket'].OutputValue" --output=text)
aws s3 sync dist/baby-tracker-ui s3://$BUCKET --delete
- name: Create invalidation
env:
STACK_NAME: HordeNG-prod
AWS_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
CDN_ID=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='Cdn'].OutputValue" --output=text)
aws cloudfront create-invalidation --distribution-id $CDN_ID --paths "/*"

0 comments on commit e1e7e2a

Please sign in to comment.