Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .gitattributes

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/codesee.yml

This file was deleted.

88 changes: 68 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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"
77 changes: 0 additions & 77 deletions docs/404.html

This file was deleted.

1 change: 0 additions & 1 deletion docs/CNAME

This file was deleted.

7 changes: 0 additions & 7 deletions init.sh

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "View language usage per repo or total by username",
"main": "client/src/index.ts",
"scripts": {
"dev": "NODE_ENV=development webpack --mode development -w",
"build:dev": "NODE_ENV=development webpack --mode development -w",
"build:prod": "NODE_ENV=production webpack --mode production",
"fix": "eslint --fix '**/*'",
"prod": "NODE_ENV=production webpack --mode production",
"start:client": "ts-node local/client.ts",
"start:server": "ts-node local/server.ts"
},
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion docs/index.html → public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<!-- Google Tag Manager -->
Expand Down
7 changes: 0 additions & 7 deletions stop.sh

This file was deleted.

2 changes: 1 addition & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const mode = process.env.NODE_ENV as
const production = mode === 'production';

const SRC_DIR = path.join(path.resolve(), '/client/src');
const DIST_DIR = path.join(path.resolve(), '/docs/public/dist');
const DIST_DIR = path.join(path.resolve(), '/public/dist');

const configuration: Configuration = {
entry: `${SRC_DIR}/index.ts`,
Expand Down