-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (107 loc) · 5.23 KB
/
publish.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: 'publish'
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- name: Create env file
run: |
echo "VITE_FIX_LANDING_PAGE_URL=${{ vars.FIX_LANDING_PAGE_URL }}" > .env.production
echo "VITE_FIX_DOCS_URL=${{ vars.VITE_FIX_DOCS_URL }}" > .env.production
echo "VITE_VIDEOS_ASSETS_URL=${{ vars.VIDEOS_ASSETS_URL }}" >> .env.production
echo "VITE_IMAGES_ASSETS_URL=${{ vars.IMAGES_ASSETS_URL }}" >> .env.production
echo "VITE_USE_PROXY=false" >> .env.production
echo "VITE_NETWORK_RETRY_COUNT=${{ vars.NETWORK_RETRY_COUNT }}" >> .env.production
echo "VITE_WEBSOCKET_RETRY_TIMEOUT=${{ vars.WEBSOCKET_RETRY_TIMEOUT }}" >> .env.production
echo "VITE_USE_MOCK=false" >> .env.production
echo "VITE_DISCORD_URL=${{ vars.DISCORD_URL }}" >> .env.production
echo "VITE_TRACKJS_TOKEN=${{ secrets.TRACKJS_TOKEN }}" >> .env.production
echo "VITE_MUI_LICENSE_KEY=${{ secrets.MUI_LICENSE_KEY }}" >> .env.production
echo "VITE_VERSION=${{ github.sha }}" >> .env.production
echo "VITE_LOAD_PAGE_TIMEOUT=${{ vars.LOAD_PAGE_TIMEOUT }}" >> .env.production
echo "VITE_POSTHOG_DEV_PROJECT_API_KEY=${{ secrets.POSTHOG_DEV_PROJECT_API_KEY }}" >> .env.production
echo "VITE_POSTHOG_PROD_PROJECT_API_KEY=${{ secrets.POSTHOG_PROD_PROJECT_API_KEY }}" >> .env.production
echo "VITE_POSTHOG_API_HOST=${{ vars.POSTHOG_API_HOST }}" >> .env.production
echo "VITE_POSTHOG_UI_HOST=${{ vars.POSTHOG_UI_HOST }}" >> .env.production
- name: Add models
run: |
echo "[]" > mock-apis/data/model.json
echo "{ \"accounts\": [], \"regions\": [], \"kinds\": [], \"severity\": [] }" > mock-apis/data/search-start.json
echo "[]" > mock-apis/data/table.json
echo "[]" > mock-apis/data/tags.json
- name: Create a production build
uses: devcontainers/[email protected]
with:
runCmd: yarn i18n:extract && yarn i18n:compile && PUBLIC_URL=${{ vars.PUBLIC_URL }}/${{ github.sha }}/ yarn build
- name: Move dist to target
run: |
mkdir -p target/${{ github.sha }}
cp -r dist/* target/${{ github.sha }}
- name: Create a production storybook build
uses: devcontainers/[email protected]
with:
runCmd: yarn build-storybook
- name: Publish the new version to the CDN
uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.FIX_UI_DO_SPACES_KEY }}
secret_key: ${{ secrets.FIX_UI_DO_SPACES_SECRET }}
space_name: ${{ secrets.FIX_UI_DO_SPACE_NAME }}
space_region: ${{ secrets.FIX_UI_DO_SPACE_REGION }}
out_dir: fix-ui
source: target
- name: Update the edge version on the CDN
uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.FIX_UI_DO_SPACES_KEY }}
secret_key: ${{ secrets.FIX_UI_DO_SPACES_SECRET }}
space_name: ${{ secrets.FIX_UI_DO_SPACE_NAME }}
space_region: ${{ secrets.FIX_UI_DO_SPACE_REGION }}
out_dir: fix-ui/edge
source: target/${{ github.sha }}/index.html
- name: Publish storybook to the CDN
uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.FIX_UI_DO_SPACES_KEY }}
secret_key: ${{ secrets.FIX_UI_DO_SPACES_SECRET }}
space_name: ${{ secrets.FIX_UI_DO_SPACE_NAME }}
space_region: ${{ secrets.FIX_UI_DO_SPACE_REGION }}
out_dir: fix-storybook
source: storybook-static
- name: Create a patch with the new version
# writes the file with a config map definition
run: |
echo "apiVersion: apps/v1" > fixbackend-ui-patch.yaml
echo "kind: StatefulSet" >> fixbackend-ui-patch.yaml
echo "metadata:" >> fixbackend-ui-patch.yaml
echo " name: fixbackend" >> fixbackend-ui-patch.yaml
echo "spec:" >> fixbackend-ui-patch.yaml
echo " template:" >> fixbackend-ui-patch.yaml
echo " spec:" >> fixbackend-ui-patch.yaml
echo " containers:" >> fixbackend-ui-patch.yaml
echo " - name: fixbackend" >> fixbackend-ui-patch.yaml
echo " env:" >> fixbackend-ui-patch.yaml
echo " - name: FIXUI_SHA" >> fixbackend-ui-patch.yaml
echo " value: \"${{ github.sha }}\"" >> fixbackend-ui-patch.yaml
- name: Authenticate with GitHub CLI
run: |
gh auth login --with-token <<< "${{ secrets.SOME_CI_PAT }}"
- name: Bump fix-ui version
env:
GITHUB_TOKEN: ${{ secrets.SOME_CI_PAT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Some CI"
git clone "https://[email protected]/someengineering/setup-infra.git"
# update the configmap
mv fixbackend-ui-patch.yaml setup-infra/argocd/envs/dev/fixbackend/fixbackend-ui-patch.yaml
cd setup-infra
git add .
git commit -m "Bump fix-ui to ${{ github.sha }}"
git push origin main