[feat] benchmark detail (#251) #280
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: '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_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 |