diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 37fc46f9..00000000 --- a/.gitattributes +++ /dev/null @@ -1,48 +0,0 @@ -# See this article for reference: https://help.github.com/articles/dealing-with-line-endings/ -# Refreshing repo after line ending change: -# https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings - -# Handle line endings automatically for files detected as text -# and leave all files detected as binary untouched. -* text=auto - -# -# The above will handle all files NOT found below -# -# These files are text and should be normalized (Convert crlf => lf) -# Use lf as eol for these files -.editorconfig text eol=lf -.gitignore text eol=lf -*.css text eol=lf -*.df text eol=lf -*.htm text eol=lf -*.html text eol=lf -*.java text eol=lf -*.js text eol=lf -*.json text eol=lf -*.jsp text eol=lf -*.jspf text eol=lf -*.md text eol=lf -*.properties text eol=lf -*.scss text eol=lf -*.sh text eol=lf -*.tld text eol=lf -*.ts text eol=lf -*.txt text eol=lf -*.xml text eol=lf - -# These files are binary and should be left untouched -# (binary is a macro for -text -diff) -*.class binary -*.dll binary -*.ear binary -*.gif binary -*.ico binary -*.jar binary -*.jpg binary -*.jpeg binary -*.png binary -*.so binary -*.war binary - -docs/** linguist-documentation=false diff --git a/.github/workflows/codesee.yml b/.github/workflows/codesee.yml deleted file mode 100644 index 1ad9abb7..00000000 --- a/.github/workflows/codesee.yml +++ /dev/null @@ -1,20 +0,0 @@ -on: - push: - branches: - - main - pull_request_target: - types: [opened, synchronize, reopened] - -name: CodeSee - -permissions: read-all - -jobs: - codesee: - runs-on: ubuntu-latest - continue-on-error: true - name: Analyse the repo with CodeSee - steps: - - uses: Codesee-io/codesee-action@v2 - with: - codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1e50ecce..616f2d01 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,31 +1,79 @@ -name: Deploy to Auth-Server +name: Deploy on: push: branches: - main + workflow_dispatch: + inputs: + environment: + type: choice + description: 'Deploy Environment' + options: + - dev + - prod + invalidate: + description: 'Invalidate CloudFront Cache' + type: boolean + default: true + jobs: deploy: name: Deploy runs-on: ubuntu-latest + env: + DIST_NAME: ${{ vars.DIST_NAME }} + S3_BUCKET: ${{ vars.S3_BUCKET }} + DEPLOY_DIR: 'public' + steps: - - name: Configure AWS - 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: us-east-2 - - - name: Create Deployment - id: deploy - env: - APP_NAME: auth-server - DEPLOY_GROUP: gitlang - run: | - aws deploy create-deployment --ignore-application-stop-failures \ - --application-name ${{ env.APP_NAME }} \ - --deployment-group-name ${{ env.DEPLOY_GROUP }} \ - --deployment-config-name CodeDeployDefault.AllAtOnce \ - --file-exists-behavior OVERWRITE \ - --github-location repository=${{ github.repository }},commitId=${{ github.sha }} + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Build + run: | + set -x + npm i + sed -i "1i console.log('Updated:', '$(TZ=PST8PDT date)')" client/src/index.ts + npm run build:prod + + - name: Configure AWS + 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: us-east-2 + + - name: Sync to S3 + id: sync + run: | + aws s3 sync ${DEPLOY_DIR} s3://${S3_BUCKET} --delete + + - name: Invalidate CloudFront + id: invalidate + if: ${{ inputs.invalidate == true }} + run: | + dist_id="$(aws cloudfront list-distributions \ + --query "DistributionList.Items[?Comment=='${DIST_NAME}'].Id" \ + --output text)" + + if [ -z "$dist_id" ]; then + echo "No distribution found with comment: ${DIST_NAME}" + exit 1 + fi + + echo "Invalidating ${dist_id} for ${DIST_NAME}" + invalidation_id="$(aws cloudfront create-invalidation \ + --distribution-id "$dist_id" \ + --paths "/*" \ + --query "Invalidation.Id" \ + --output text)" + + echo "Invalidation started: ${invalidation_id}" + + aws cloudfront wait invalidation-completed \ + --distribution-id "$dist_id" \ + --id "$invalidation_id" + + echo "Invalidation completed" diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index 956f2da5..00000000 --- a/docs/404.html +++ /dev/null @@ -1,77 +0,0 @@ - - -
- - - - -