Merge pull request #108 from GSA-TTS/pgvector #128
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
name: Deploy to staging environment | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.head_commit.message != 'Merge pull request*' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- uses: ./.github/actions/setup-project | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.15.1' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Svelte App | |
run: npm run build | |
- name: Commit build artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} # Use PAT_TOKEN secret for authentication | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }} | |
git add -f build/ # Force add the build directory | |
git commit -m 'Add build artifacts for deployment' || echo "No changes to commit" | |
git push | |
- name: Deploy to cloud.gov | |
uses: 18f/cg-deploy-action@main | |
env: | |
OLLAMA_BASE_URL: ${{ secrets.OLLAMA_BASE_URL }} | |
WEBUI_NAME: ${{ secrets.WEBUI_NAME }} | |
SCARF_NO_ANALYTICS: ${{ secrets.SCARF_NO_ANALYTICS }} | |
DO_NOT_TRACK: ${{ secrets.DO_NOT_TRACK }} | |
ANONYMIZED_TELEMETRY: ${{ secrets.ANONYMIZED_TELEMETRY }} | |
GITHUBLOCAL_CLIENT_ID: ${{ secrets.GITHUBLOCAL_CLIENT_ID }} | |
GITHUBLOCAL_CLIENT_SECRET: ${{ secrets.GITHUBLOCAL_CLIENT_SECRET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} | |
AZURE_OPENAI_GPT35TURBO_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_GPT35TURBO_DEPLOYMENT_NAME }} | |
AZURE_OPENAI_GPT4OMNI_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_GPT4OMNI_DEPLOYMENT_NAME }} | |
WEBUI_SECRET_KEY: ${{ secrets.WEBUI_SECRET_KEY }} | |
DEV_ADMIN_EMAILS: ${{ secrets.DEV_ADMIN_EMAILS }} | |
DEV_USER_EMAILS: ${{ secrets.DEV_USER_EMAILS }} | |
RAG_OPENAI_API_BASE_URL: ${{ secrets.RAG_OPENAI_API_BASE_URL }} | |
RAG_OPENAI_API_KEY: ${{ secrets.RAG_OPENAI_API_KEY }} | |
RAG_EMBEDDING_ENGINE: ${{ secrets.RAG_EMBEDDING_ENGINE }} | |
with: | |
cf_username: ${{ secrets.CLOUDGOV_USERNAME }} | |
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }} | |
cf_org: gsa-10x-prototyping | |
cf_space: sandbox | |
push_arguments: >- | |
--vars-file deploy-config/staging.yml | |
--var OLLAMA_BASE_URL="$OLLAMA_BASE_URL" | |
--var WEBUI_NAME="$WEBUI_NAME" | |
--var SCARF_NO_ANALYTICS="$SCARF_NO_ANALYTICS" | |
--var DO_NOT_TRACK="$DO_NOT_TRACK" | |
--var ANONYMIZED_TELEMETRY="$ANONYMIZED_TELEMETRY" | |
--var GITHUBLOCAL_CLIENT_ID="$GITHUBLOCAL_CLIENT_ID" | |
--var GITHUBLOCAL_CLIENT_SECRET="$GITHUBLOCAL_CLIENT_SECRET" | |
--var AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" | |
--var AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" | |
--var AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION" | |
--var AZURE_OPENAI_API_KEY="$AZURE_OPENAI_API_KEY" | |
--var AZURE_OPENAI_ENDPOINT="$AZURE_OPENAI_ENDPOINT" | |
--var AZURE_OPENAI_GPT35TURBO_DEPLOYMENT_NAME="$AZURE_OPENAI_GPT35TURBO_DEPLOYMENT_NAME" | |
--var AZURE_OPENAI_GPT4OMNI_DEPLOYMENT_NAME="$AZURE_OPENAI_GPT4OMNI_DEPLOYMENT_NAME" | |
--var WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" | |
--var DEV_ADMIN_EMAILS="$DEV_ADMIN_EMAILS" | |
--var DEV_USER_EMAILS="$DEV_USER_EMAILS" | |
--var RAG_OPENAI_API_BASE_URL="$RAG_OPENAI_API_BASE_URL" | |
--var RAG_OPENAI_API_KEY="$RAG_OPENAI_API_KEY" | |
--var RAG_EMBEDDING_ENGINE="$RAG_EMBEDDING_ENGINE" | |
# New Step: Clean up build artifacts | |
- name: Remove build artifacts and commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} # Use PAT_TOKEN secret for authentication | |
run: | | |
git rm -rf build/ | |
git add . | |
git commit -m "Remove build artifacts after deployment" || echo "No changes to commit" | |
git push --force | |
bail: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: core.setFailed('Checks failed, not deploying') |