-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (100 loc) · 4.66 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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')