Skip to content

docs: removing left over references to the git secret stuff #209

docs: removing left over references to the git secret stuff

docs: removing left over references to the git secret stuff #209

Workflow file for this run

# This is the workflow for deploying the smile docs
name: docs-deploy
# Controls when the workflow will run
on:
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs-deploy.yml'
workflow_dispatch:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: smile-docs
cancel-in-progress: false
# 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 "deploy"
docs-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
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
# setup node.js
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node_version'
# install node packages
- name: Install node dependencies
run: npm install
# accesses some git variables and processes them to be lower case/short/escaped
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
with:
short-length: 7
# Configure git-specific .env file
- name: Expose git-specific information to the Vite environment
env:
ENV_FILE: 'env/.env.git.local'
run: |
escape_quotes() {
# Get the input string
input="$1"
# Escape single quotes
input="${input//\'/\'}"
# Escape double quotes
input="${input//\"/\\\"}"
# Return the escaped string
echo "$input"
}
echo "------"
echo "# DO NOT EDIT THIS FILE IT IS AUTOMATICALLY GENERATED" > $ENV_FILE
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_COMMIT_MESSAGE" >> $ENV_FILE
VITE_GIT_LAST_MSG="$GITHUB_COMMIT_MESSAGE"
fi
echo "VITE_DEPLOY_BASE_PATH = '/${VITE_GIT_OWNER}/${VITE_GIT_REPO_NAME}/${VITE_GIT_BRANCH_NAME}/'" >> $ENV_FILE
CODENAME=$(node scripts/codenamize.cjs "/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/${{ env.GITHUB_REF_SLUG }}")
echo "VITE_CODE_NAME = ${CODENAME}" >> $ENV_FILE
cat $ENV_FILE
# 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/dotenv-action@v1.1
with:
path: 'env/.env.git.local'
- name: Load the general config dotenv file
id: dotenv_config
uses: falti/dotenv-action@v1.1
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
- name: Rebuild docs
run: npm run docs:build
# Deploy files to web server
- name: rsync to server
uses: burnett01/rsync-deployments@5.2
with:
switches: -avrz --delete
path: docs/.vitepress/dist/
remote_path: ${{ secrets.DOCS_DEPLOY_PATH }}
remote_host: ${{ secrets.DOCS_DEPLOY_HOST }}
remote_port: ${{ secrets.DOCS_DEPLOY_PORT }}
remote_user: ${{ secrets.DOCS_DEPLOY_USER }}
remote_key: ${{ secrets.DOCS_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/slack-github-action@v1.25.0
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: |
{
"github_username": "${{ github.actor }}",
"deploy_url": "Docs were updated at https://smile.gureckislab.org/",
"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 }}"
}