Spaces:
Sleeping
Sleeping
MingruiZhang
commited on
build: Simplify release note to production only and use existing solutions (#120)
Browse files- .github/workflows/cicd.yaml +0 -34
- .github/workflows/prod-deploy.yml +14 -32
.github/workflows/cicd.yaml
CHANGED
@@ -143,37 +143,3 @@ 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 }}
|
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 |
-
run: |
|
164 |
-
git tag $NEW_TAG
|
165 |
-
git push origin $NEW_TAG
|
166 |
-
|
167 |
-
- name: Create draft release with generated release notes
|
168 |
-
env:
|
169 |
-
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
170 |
-
run: |
|
171 |
-
# List all releases and filter out drafts
|
172 |
-
draft_releases=$(gh release list --json tagName,isDraft --jq '.[] | select(.isDraft) | .tagName')
|
173 |
-
|
174 |
-
# Loop through each draft release and delete it (created by previous cicd.yml)
|
175 |
-
for release in $draft_releases; do
|
176 |
-
echo "Deleting draft release: $release"
|
177 |
-
gh release delete "$release" --yes
|
178 |
-
done
|
179 |
-
gh release create $NEW_TAG --generate-notes --draft
|
|
|
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 }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/prod-deploy.yml
CHANGED
@@ -104,36 +104,18 @@ jobs:
|
|
104 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
105 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
106 |
|
107 |
-
- name: Generate
|
108 |
-
id:
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
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 |
-
run: |
|
124 |
-
git tag $NEW_TAG
|
125 |
-
git push origin $NEW_TAG
|
126 |
|
127 |
-
- name: Create
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
# Loop through each draft release and delete it (created by cicd.yml)
|
135 |
-
for release in $draft_releases; do
|
136 |
-
echo "Deleting draft release: $release"
|
137 |
-
gh release delete "$release" --yes
|
138 |
-
done
|
139 |
-
gh release create $NEW_TAG --generate-notes
|
|
|
104 |
--set env.POSTGRES_PRISMA_URL=${{ vars.POSTGRES_PRISMA_URL }} \
|
105 |
--set env.AGENT_HOST=${{ vars.AGENT_HOST }}
|
106 |
|
107 |
+
- name: Generate release tag
|
108 |
+
id: release_tag
|
109 |
+
uses: amitsingh-007/[email protected]
|
110 |
+
with:
|
111 |
+
github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
112 |
+
tag_prefix: 'v'
|
113 |
+
tag_template: 'yyyy.mm.dd.i'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
- name: Create new release
|
116 |
+
uses: softprops/action-gh-release@v2
|
117 |
+
with:
|
118 |
+
name: Release ${{ steps.release_tag.outputs.next_release_tag }}
|
119 |
+
tag_name: ${{ steps.release_tag.outputs.next_release_tag }}
|
120 |
+
token: ${{secrets.REPO_ACCESS_TOKEN}}
|
121 |
+
generate_release_notes: true
|
|
|
|
|
|
|
|
|
|
|
|