Spaces:
Sleeping
Sleeping
MingruiZhang
commited on
Commit
•
648bd9d
1
Parent(s):
ade4562
build: Release note when deployment (#111)
Browse filesTested on https://github.com/landing-ai/mingrui-playground
- .github/CODEOWNERS +1 -1
- .github/workflows/cicd.yaml +43 -7
- .github/workflows/prod-deploy.yml +42 -6
.github/CODEOWNERS
CHANGED
@@ -3,4 +3,4 @@
|
|
3 |
# It uses the same pattern rule for gitignore file
|
4 |
# https://git-scm.com/docs/gitignore#_pattern_format
|
5 |
|
6 |
-
* @MingruiZhang @wuyiqunLu
|
|
|
3 |
# It uses the same pattern rule for gitignore file
|
4 |
# https://git-scm.com/docs/gitignore#_pattern_format
|
5 |
|
6 |
+
* @MingruiZhang @wuyiqunLu @yzld2002
|
.github/workflows/cicd.yaml
CHANGED
@@ -6,11 +6,11 @@ on:
|
|
6 |
- main
|
7 |
|
8 |
env:
|
9 |
-
repo_name:
|
10 |
-
aws_account_id:
|
11 |
-
aws_region:
|
12 |
-
cluster_name:
|
13 |
-
namespace:
|
14 |
|
15 |
jobs:
|
16 |
build:
|
@@ -38,7 +38,7 @@ jobs:
|
|
38 |
uses: aws-actions/amazon-ecr-login@v2
|
39 |
with:
|
40 |
registries: ${{ env.aws_account_id }}
|
41 |
-
mask-password:
|
42 |
|
43 |
- name: Set short sha
|
44 |
id: sha_short
|
@@ -74,7 +74,7 @@ jobs:
|
|
74 |
- name: Set up Node.js
|
75 |
uses: actions/setup-node@v4
|
76 |
with:
|
77 |
-
node-version:
|
78 |
|
79 |
- name: Install pnpm
|
80 |
run: npm install -g [email protected]
|
@@ -143,3 +143,39 @@ jobs:
|
|
143 |
--set env.OPENAI_API_KEY=${{ vars.OPENAI_API_KEY }} \
|
144 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
145 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
- main
|
7 |
|
8 |
env:
|
9 |
+
repo_name: 'vision-agent'
|
10 |
+
aws_account_id: '970073041993'
|
11 |
+
aws_region: 'us-east-2'
|
12 |
+
cluster_name: 'llens-app-dev'
|
13 |
+
namespace: 'datamanagement'
|
14 |
|
15 |
jobs:
|
16 |
build:
|
|
|
38 |
uses: aws-actions/amazon-ecr-login@v2
|
39 |
with:
|
40 |
registries: ${{ env.aws_account_id }}
|
41 |
+
mask-password: 'true' # see: https://github.com/aws-actions/amazon-ecr-login#docker-credentials
|
42 |
|
43 |
- name: Set short sha
|
44 |
id: sha_short
|
|
|
74 |
- name: Set up Node.js
|
75 |
uses: actions/setup-node@v4
|
76 |
with:
|
77 |
+
node-version: '20'
|
78 |
|
79 |
- name: Install pnpm
|
80 |
run: npm install -g [email protected]
|
|
|
143 |
--set env.OPENAI_API_KEY=${{ vars.OPENAI_API_KEY }} \
|
144 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
145 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
146 |
+
|
147 |
+
- name: Generate new tag
|
148 |
+
id: vars
|
149 |
+
run: |
|
150 |
+
NEW_TAG_BASE="aws-development-$(date +%Y-%m-%d)"
|
151 |
+
LAST_TAG=$(git ls-remote --tags origin "${NEW_TAG_BASE}*" | awk -F'\t' '{print $2}' | sort -V | tail -1)
|
152 |
+
if [[ $LAST_TAG == refs/tags/${NEW_TAG_BASE}* ]]; then
|
153 |
+
INDEX=$(echo $LAST_TAG | awk -F"/" '{print $NF}' )
|
154 |
+
INDEX=$((INDEX + 1))
|
155 |
+
else
|
156 |
+
INDEX=1
|
157 |
+
fi
|
158 |
+
NEW_TAG="${NEW_TAG_BASE}/${INDEX}"
|
159 |
+
|
160 |
+
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
|
161 |
+
|
162 |
+
- name: Push new tag
|
163 |
+
env:
|
164 |
+
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
165 |
+
run: |
|
166 |
+
git tag $NEW_TAG
|
167 |
+
git push origin $NEW_TAG
|
168 |
+
|
169 |
+
- name: Create draft release with generated release notes
|
170 |
+
env:
|
171 |
+
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
172 |
+
run: |
|
173 |
+
# List all releases and filter out drafts
|
174 |
+
draft_releases=$(gh release list --json tagName,isDraft --jq '.[] | select(.isDraft) | .tagName')
|
175 |
+
|
176 |
+
# Loop through each draft release and delete it (created by previous cicd.yml)
|
177 |
+
for release in $draft_releases; do
|
178 |
+
echo "Deleting draft release: $release"
|
179 |
+
gh release delete "$release" --yes
|
180 |
+
done
|
181 |
+
gh release create $NEW_TAG --generate-notes --draft
|
.github/workflows/prod-deploy.yml
CHANGED
@@ -3,11 +3,11 @@ name: deploy to aws production
|
|
3 |
on: workflow_dispatch
|
4 |
|
5 |
env:
|
6 |
-
repo_name:
|
7 |
-
aws_account_id:
|
8 |
-
aws_region:
|
9 |
-
cluster_name:
|
10 |
-
namespace:
|
11 |
|
12 |
jobs:
|
13 |
db_migration:
|
@@ -26,7 +26,7 @@ jobs:
|
|
26 |
- name: Set up Node.js
|
27 |
uses: actions/setup-node@v4
|
28 |
with:
|
29 |
-
node-version:
|
30 |
|
31 |
- name: Install pnpm
|
32 |
run: npm install -g [email protected]
|
@@ -103,3 +103,39 @@ jobs:
|
|
103 |
--set env.OPENAI_API_KEY=${{ vars.OPENAI_API_KEY }} \
|
104 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
105 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
on: workflow_dispatch
|
4 |
|
5 |
env:
|
6 |
+
repo_name: 'vision-agent'
|
7 |
+
aws_account_id: '944932498359'
|
8 |
+
aws_region: 'us-east-2'
|
9 |
+
cluster_name: 'llens-app-production'
|
10 |
+
namespace: 'datamanagement'
|
11 |
|
12 |
jobs:
|
13 |
db_migration:
|
|
|
26 |
- name: Set up Node.js
|
27 |
uses: actions/setup-node@v4
|
28 |
with:
|
29 |
+
node-version: '20'
|
30 |
|
31 |
- name: Install pnpm
|
32 |
run: npm install -g [email protected]
|
|
|
103 |
--set env.OPENAI_API_KEY=${{ vars.OPENAI_API_KEY }} \
|
104 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
105 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
106 |
+
|
107 |
+
- name: Generate new tag
|
108 |
+
id: vars
|
109 |
+
run: |
|
110 |
+
NEW_TAG_BASE="aws-production-$(date +%Y-%m-%d)"
|
111 |
+
LAST_TAG=$(git ls-remote --tags origin "${NEW_TAG_BASE}*" | awk -F'\t' '{print $2}' | sort -V | tail -1)
|
112 |
+
if [[ $LAST_TAG == refs/tags/${NEW_TAG_BASE}* ]]; then
|
113 |
+
INDEX=$(echo $LAST_TAG | awk -F"/" '{print $NF}' )
|
114 |
+
INDEX=$((INDEX + 1))
|
115 |
+
else
|
116 |
+
INDEX=1
|
117 |
+
fi
|
118 |
+
NEW_TAG="${NEW_TAG_BASE}/${INDEX}"
|
119 |
+
|
120 |
+
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
|
121 |
+
|
122 |
+
- name: Push new tag
|
123 |
+
env:
|
124 |
+
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
125 |
+
run: |
|
126 |
+
git tag $NEW_TAG
|
127 |
+
git push origin $NEW_TAG
|
128 |
+
|
129 |
+
- name: Create production release with generated release notes
|
130 |
+
env:
|
131 |
+
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
132 |
+
run: |
|
133 |
+
# List all releases and filter out drafts
|
134 |
+
draft_releases=$(gh release list --json tagName,isDraft --jq '.[] | select(.isDraft) | .tagName')
|
135 |
+
|
136 |
+
# Loop through each draft release and delete it (created by cicd.yml)
|
137 |
+
for release in $draft_releases; do
|
138 |
+
echo "Deleting draft release: $release"
|
139 |
+
gh release delete "$release" --yes
|
140 |
+
done
|
141 |
+
gh release create $NEW_TAG --generate-notes
|