-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 346f901
Showing
223 changed files
with
61,313 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
node: true, | ||
}, | ||
extends: ['plugin:vue/essential', 'airbnb-base', 'prettier'], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
plugins: ['vue', 'import'], | ||
settings: { | ||
'import/resolver': { | ||
alias: { | ||
map: [ | ||
['@', './src'], // default @ -> ./src alias in Vue, it exists even if vue.config.js is not present | ||
/* | ||
*... add your own webpack aliases if you have them in vue.config.js/other webpack config file | ||
* if you forget to add them, eslint-plugin-import will not throw linting error in .vue imports that contain the webpack alias you forgot to add | ||
*/ | ||
], | ||
extensions: ['.vue', '.json', '.js'], | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'no-unused-vars': 'off', | ||
'import/extensions': [ | ||
'error', | ||
'ignorePackages', | ||
{ | ||
js: 'never', | ||
vue: 'always', | ||
}, | ||
], | ||
'vue/no-multiple-template-root': 'off', | ||
}, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "smile-db-test" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: DEPLOY_ERROR_NOTIFY | ||
|
||
on: | ||
workflow_run: | ||
workflows: [DEPLOY] | ||
types: [completed] | ||
|
||
jobs: | ||
on-failure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: Send notification to lab slack | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ERROR_URL }} | ||
if: ${{ env.SLACK_WEBHOOK_URL != '' }} # this should only run if SLACK_WEBHOOK_URL exists | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
# This data can be any valid JSON from a previous step in the GitHub Action | ||
payload: | | ||
{ | ||
"github_username": "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}", | ||
"message": "I'm sorry to report there was an error building and deploying your site. Please see https://smile.gureckislab.org/deploying.html#debugging-deployment-issues" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
# This is a basic workflow to deploy a specific git hash | ||
|
||
name: DEPLOY_HASH | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
github_sha: | ||
description: 'The github sha you want to deploy' | ||
required: true | ||
type: string | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
deploy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
## TODO CHANGE THIS TO CHECK OUT THE BRANCH THAT WAS COMMITTED TO | ||
- name: Checkout sha | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.github_sha }} | ||
|
||
# setup node.js | ||
- name: Setup node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.15.1 # this is what i'm using locally | ||
|
||
# install node packages | ||
- name: Install node dependencies | ||
run: npm install | ||
|
||
# install node packages | ||
- name: Build css from scss | ||
run: npm run css-build | ||
|
||
# accesses some git variables and processes them to be lower case/short/escaped | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
# Configure git-specific .env file | ||
- name: Expose git-specific information to the Vite environment | ||
env: | ||
ENV_FILE: 'env/.env.git.local' | ||
run: | | ||
echo "------" | ||
if test -z "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | ||
then | ||
echo "VITE_PROJECT_NAME = unknown" > $ENV_FILE | ||
VITE_PROJECT_NAME='unknown' | ||
else | ||
echo "VITE_PROJECT_NAME = ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" > $ENV_FILE | ||
VITE_PROJECT_NAME='${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}' | ||
fi | ||
if test -z "${{ env.GITHUB_SHA_SHORT }}" | ||
then | ||
echo "VITE_GIT_HASH = x0x0x0x0" >> $ENV_FILE | ||
VITE_GIT_HASH='x0x0x0x0' | ||
else | ||
echo "VITE_GIT_HASH = ${{ env.GITHUB_SHA_SHORT }}" >> $ENV_FILE | ||
VITE_GIT_HASH='${{ env.GITHUB_SHA_SHORT }}' | ||
fi | ||
if test -z "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" | ||
then | ||
echo "VITE_GIT_OWNER = unknown_owner" >> $ENV_FILE | ||
VITE_GIT_OWNER='unknown_owner' | ||
else | ||
echo "VITE_GIT_OWNER = ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" >> $ENV_FILE | ||
VITE_GIT_OWNER='${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}' | ||
fi | ||
if test -z "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" | ||
then | ||
echo "VITE_GIT_REPO_NAME = unknown_repo" >> $ENV_FILE | ||
VITE_GIT_REPO_NAME='unknown_repo' | ||
else | ||
echo "VITE_GIT_REPO_NAME = ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" >> $ENV_FILE | ||
VITE_GIT_REPO_NAME='${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}' | ||
fi | ||
if test -z "${{ env.GITHUB_REF_SLUG }}" | ||
then | ||
echo "VITE_GIT_BRANCH_NAME = unknown_branch" >> $ENV_FILE | ||
VITE_GIT_BRANCH_NAME='unknown_branch' | ||
else | ||
echo "VITE_GIT_BRANCH_NAME = ${{ env.GITHUB_REF_SLUG }}" >> $ENV_FILE | ||
VITE_GIT_BRANCH_NAME='${{ env.GITHUB_REF_SLUG }}' | ||
fi | ||
if test -z "${{ github.event.head_commit.message }}" | ||
then | ||
echo "VITE_GIT_LAST_MSG = (no commit message)" >> $ENV_FILE | ||
VITE_GIT_LAST_MSG='(no commit message)' | ||
else | ||
echo "VITE_GIT_LAST_MSG = ${{ github.event.head_commit.message }}" >> $ENV_FILE | ||
VITE_GIT_LAST_MSG='${{ github.event.head_commit.message }}' | ||
fi | ||
echo "VITE_DEPLOY_BASE_PATH = '/hashes/${VITE_GIT_OWNER}/${VITE_GIT_REPO_NAME}/${VITE_GIT_HASH}/'" >> $ENV_FILE | ||
CODENAME=$(node scripts/codenamize.js "/${OWNER}/${PROJECT_NAME}/${BRANCH}") | ||
echo "VITE_CODE_NAME = ${CODENAME}" >> $ENV_FILE | ||
cat $ENV_FILE | ||
# put the full path name in VITE_DEPLOY_BASE_PATH | ||
|
||
# Configure secure information configuration | ||
- name: Expose secret information to the Vite environment | ||
env: | ||
SECRET_APP_CONFIG: ${{ secrets.SECRET_APP_CONFIG }} | ||
SECRET_ENV_FILE: 'env/.env.local' | ||
run: | | ||
echo "------" | ||
echo $SECRET_APP_CONFIG | base64 --decode > $SECRET_ENV_FILE | ||
# load the environment | ||
- name: Load the github dotenv file | ||
id: dotenv_github | ||
uses: falti/[email protected] | ||
with: | ||
path: './env/.env.git.local' | ||
|
||
- name: Load the general config dotenv file | ||
id: dotenv_config | ||
uses: falti/[email protected] | ||
with: | ||
path: './env/.env.local' | ||
|
||
# echo all the environment variables | ||
- name: echo the environment variables | ||
run: | | ||
echo "deploy url: ${{ secrets.EXP_DEPLOY_PATH }}${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }}" | ||
# place the deploy settings into the environment files | ||
# this one needs to be made available to vite.config.js | ||
- name: create deploy file | ||
env: | ||
DEPLOY_ENV_FILE: 'env/.env.deploy.local' | ||
run: | | ||
echo "VITE_DEPLOY_URL = 'https://${{ secrets.EXP_DEPLOY_HOST }}${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }}'" > $DEPLOY_ENV_FILE | ||
echo 'VITE_CODE_NAME_DEPLOY_URL = "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}"' >> $DEPLOY_ENV_FILE | ||
cat $DEPLOY_ENV_FILE | ||
# Build the web app | ||
- name: Build css files | ||
run: npm run css-build | ||
|
||
# Build the web app | ||
- name: Build web app | ||
run: npm run build | ||
|
||
# make remote folder if necessar | ||
- name: create the remote folders if they don't exist | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EXP_DEPLOY_HOST }} | ||
username: ${{ secrets.EXP_DEPLOY_USER }} | ||
key: ${{ secrets.EXP_DEPLOY_KEY }} | ||
port: ${{ secrets.EXP_DEPLOY_PORT }} | ||
script: mkdir -p ${{ secrets.EXP_DEPLOY_PATH }}/${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }}; mkdir -p ${{ secrets.EXP_DEPLOY_PATH }}/e; mkdir -p ${{ secrets.EXP_DEPLOY_PATH }}/hashes | ||
|
||
|
||
# Deploy files to web server | ||
- name: rsync to server | ||
uses: burnett01/[email protected] | ||
with: | ||
switches: -avrz --delete | ||
path: dist/ | ||
remote_path: ${{ secrets.EXP_DEPLOY_PATH }}/${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }} # this should be configured with branch name and versioning | ||
remote_host: ${{ secrets.EXP_DEPLOY_HOST }} | ||
remote_port: ${{ secrets.EXP_DEPLOY_PORT }} | ||
remote_user: ${{ secrets.EXP_DEPLOY_USER }} | ||
remote_key: ${{ secrets.EXP_DEPLOY_KEY }} | ||
|
||
# send a notification at the end | ||
- name: Send notification to lab slack | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: ${{ env.SLACK_WEBHOOK_URL != '' }} # this should only run if SLACK_WEBHOOK exists | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
# This data can be any valid JSON from a previous step in the GitHub Action | ||
payload: | | ||
{ | ||
"github_username": "${{ steps.dotenv_github.outputs.VITE_GIT_OWNER }}", | ||
"deploy_url": "https://${{ secrets.EXP_DEPLOY_HOST }}${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }}", | ||
"github_hash": "https://github.com/${{ steps.dotenv_github.outputs.VITE_GIT_OWNER }}/${{ steps.dotenv_github.outputs.VITE_GIT_REPO_NAME }}/commit/${{ steps.dotenv_github.outputs.VITE_GIT_HASH }}" | ||
} |
Oops, something went wrong.