-
Notifications
You must be signed in to change notification settings - Fork 43
78 lines (66 loc) · 2.42 KB
/
web-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
name: prompty.ai web deploy
on:
push:
branches:
- main
paths:
- 'web/**'
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build-and-deploy-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create tag
run: |
echo "TAG=v$(TZ='America/Los_Angeles' date +%Y%m%d.%H%M%S)" >> "$GITHUB_ENV"
echo "Using tag: ${TAG}"
- name: Log in to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: rewrite version
run: |
echo "export const VERSION = '$TAG';" > web/src/lib/version.ts
cat web/src/lib/version.ts
- name: rewrite base
run: |
echo "export const BASE = 'https://prompty.ai';" > web/src/lib/base.ts
cat web/src/lib/base.ts
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_ENDPOINT }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push container
run: |
cd web
docker build . -t ${{ secrets.REGISTRY_ENDPOINT }}/prompty/web:${TAG}
docker push ${{ secrets.REGISTRY_ENDPOINT }}/prompty/web:${TAG}
- name: Push Container
run: |
az containerapp up --name prompty-web \
--image ${{ secrets.REGISTRY_ENDPOINT }}/prompty/web:${TAG} \
--ingress external \
--target-port 3000 \
--resource-group prompty \
--registry-server ${{ secrets.REGISTRY_ENDPOINT }} \
--registry-username ${{ secrets.REGISTRY_USERNAME }} \
--registry-password ${{ secrets.REGISTRY_PASSWORD }}
az containerapp update --name prompty-web \
--resource-group prompty \
--min-replicas 1 \
--max-replicas 5 \
--scale-rule-name azure-http-rule \
--scale-rule-type http \
--scale-rule-http-concurrency 100 \
--no-wait
- name: Logout
run: |
az logout