-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (72 loc) · 3.02 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
name: 'publish'
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- name: Create .env file
run: |
echo "VITE_NETWORK_RETRY_COUNT=5" > .env
echo "VITE_WEBSOCKET_RETRY_TIMEOUT=5000" >> .env
- name: Create a production build
uses: devcontainers/[email protected]
with:
runCmd: PUBLIC_URL=https://cdn.some.engineering/fix-ui/${{ github.sha }}/ yarn build
- name: Move dist to target
run: |
mkdir -p target/${{ github.sha }}
cp -r dist/* target/${{ github.sha }}
- 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: 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