Skip to content

Commit ceba9a7

Browse files
tea-artistgithub-actions[bot]boris-w
authored
[sync] fix(ci): encode upload assets config (#3030)
Synced from teableio/teable-ee@8f7e381 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Boris <boris2code@outlook.com>
1 parent bb024c5 commit ceba9a7

19 files changed

Lines changed: 441 additions & 4495 deletions

File tree

.github/workflows/publish-release.yml

Lines changed: 4 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,10 @@ on:
77
description: 'Release tag name, e.g. release.2026-04-20T10-38-57Z.1507'
88
required: true
99
type: string
10-
public_release_record_id:
11-
description: 'Teable public release draft record ID'
12-
required: false
13-
type: string
1410
release_note:
1511
description: 'Final English release note in Markdown'
1612
required: true
1713
type: string
18-
source_commit:
19-
description: 'Teable EE source commit SHA'
20-
required: false
21-
type: string
22-
community_commit:
23-
description: 'Teable community sync commit SHA'
24-
required: false
25-
type: string
26-
trigger:
27-
description: 'Who triggered the publish'
28-
required: false
29-
type: string
3014
publish_latest:
3115
description: 'Whether GitHub should mark this release as latest'
3216
required: false
@@ -39,12 +23,6 @@ permissions:
3923
jobs:
4024
publish:
4125
runs-on: ubuntu-latest
42-
env:
43-
PUBLIC_RELEASE_TABLE_ID: tblX2CdgkDLtJiu6r0v
44-
PUBLIC_GITHUB_URL_FIELD_ID: flduhgmWYWM9KIhctli
45-
PUBLIC_PUBLISHED_AT_FIELD_ID: fldNSquOmeADd7UH7Z6
46-
PUBLIC_GITHUB_RESULT_FIELD_ID: fldVVv7LgxSmS7l7rII
47-
PUBLIC_PUBLISH_ERROR_FIELD_ID: fldjQwcMZMwG3vExSm8
4826

4927
steps:
5028
- name: Checkout develop
@@ -56,40 +34,16 @@ jobs:
5634
- name: Build release body
5735
env:
5836
RELEASE_NOTE: ${{ inputs.release_note }}
59-
SOURCE_COMMIT: ${{ inputs.source_commit }}
60-
COMMUNITY_COMMIT: ${{ inputs.community_commit }}
61-
TRIGGER: ${{ inputs.trigger }}
6237
run: |
63-
{
64-
printf '%s\n\n' "$RELEASE_NOTE"
65-
printf '---\n\n'
66-
printf 'Published from `develop` head in `teableio/teable`.\n\n'
67-
68-
if [ -n "$SOURCE_COMMIT" ]; then
69-
printf -- '- EE source commit: `%s`\n' "$SOURCE_COMMIT"
70-
fi
71-
72-
if [ -n "$COMMUNITY_COMMIT" ]; then
73-
printf -- '- Community sync commit: `%s`\n' "$COMMUNITY_COMMIT"
74-
fi
75-
76-
if [ -n "$TRIGGER" ]; then
77-
printf -- '- Triggered by: `%s`\n' "$TRIGGER"
78-
fi
79-
} > release-body.md
38+
printf '%s\n' "$RELEASE_NOTE" > release-body.md
8039
8140
- name: Create or update GitHub release
82-
id: publish_release
8341
env:
8442
GH_TOKEN: ${{ github.token }}
8543
RELEASE_ID: ${{ inputs.release_id }}
8644
PUBLISH_LATEST: ${{ inputs.publish_latest && 'true' || 'false' }}
8745
run: |
88-
set +e
89-
90-
publish_status="success"
91-
release_url=""
92-
error_message=""
46+
set -euo pipefail
9347
9448
ensure_tag() {
9549
local target_sha
@@ -145,94 +99,5 @@ jobs:
14599
fi
146100
}
147101
148-
if ! ensure_tag; then
149-
publish_status="failed"
150-
error_message="Failed to create or verify release tag ${RELEASE_ID}"
151-
elif ! upsert_release; then
152-
publish_status="failed"
153-
error_message="Failed to create or update GitHub release ${RELEASE_ID}"
154-
fi
155-
156-
{
157-
echo "status=${publish_status}"
158-
echo "release_url=${release_url}"
159-
echo "error_message=${error_message}"
160-
} >> "$GITHUB_OUTPUT"
161-
162-
exit 0
163-
164-
- name: Write GitHub publish result back to Teable
165-
if: ${{ inputs.public_release_record_id != '' && secrets.TEABLE_API_TOKEN != '' }}
166-
env:
167-
TEABLE_API_TOKEN: ${{ secrets.TEABLE_API_TOKEN }}
168-
PUBLIC_RELEASE_RECORD_ID: ${{ inputs.public_release_record_id }}
169-
PUBLISH_STATUS: ${{ steps.publish_release.outputs.status }}
170-
RELEASE_URL: ${{ steps.publish_release.outputs.release_url }}
171-
ERROR_MESSAGE: ${{ steps.publish_release.outputs.error_message }}
172-
run: |
173-
set -euo pipefail
174-
175-
teable_patch_record() {
176-
local table_id="$1"
177-
local record_id="$2"
178-
local payload="$3"
179-
180-
http_code=$(curl -s -w "%{http_code}" -o /tmp/teable-patch.json \
181-
-X PATCH "https://app.teable.ai/api/table/${table_id}/record/${record_id}" \
182-
-H "Authorization: Bearer ${TEABLE_API_TOKEN}" \
183-
-H 'Content-Type: application/json' \
184-
-d "${payload}")
185-
186-
if [ "${http_code}" -lt 200 ] || [ "${http_code}" -ge 300 ]; then
187-
cat /tmp/teable-patch.json
188-
return 1
189-
fi
190-
}
191-
192-
if [ "${PUBLISH_STATUS}" = "success" ]; then
193-
published_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
194-
public_payload="$(jq -nc \
195-
--arg url_field "${PUBLIC_GITHUB_URL_FIELD_ID}" \
196-
--arg published_at_field "${PUBLIC_PUBLISHED_AT_FIELD_ID}" \
197-
--arg result_field "${PUBLIC_GITHUB_RESULT_FIELD_ID}" \
198-
--arg error_field "${PUBLIC_PUBLISH_ERROR_FIELD_ID}" \
199-
--arg release_url "${RELEASE_URL}" \
200-
--arg published_at "${published_at}" \
201-
'{
202-
fieldKeyType: "id",
203-
typecast: true,
204-
record: {
205-
fields: {
206-
($url_field): $release_url,
207-
($published_at_field): $published_at,
208-
($result_field): "Success",
209-
($error_field): ""
210-
}
211-
}
212-
}')"
213-
214-
teable_patch_record "${PUBLIC_RELEASE_TABLE_ID}" "${PUBLIC_RELEASE_RECORD_ID}" "${public_payload}"
215-
else
216-
public_payload="$(jq -nc \
217-
--arg result_field "${PUBLIC_GITHUB_RESULT_FIELD_ID}" \
218-
--arg error_field "${PUBLIC_PUBLISH_ERROR_FIELD_ID}" \
219-
--arg error_message "${ERROR_MESSAGE}" \
220-
'{
221-
fieldKeyType: "id",
222-
typecast: true,
223-
record: {
224-
fields: {
225-
($result_field): "Failed",
226-
($error_field): $error_message
227-
}
228-
}
229-
}')"
230-
231-
teable_patch_record "${PUBLIC_RELEASE_TABLE_ID}" "${PUBLIC_RELEASE_RECORD_ID}" "${public_payload}"
232-
fi
233-
234-
- name: Fail job when publish was not successful
235-
if: ${{ steps.publish_release.outputs.status != 'success' }}
236-
run: |
237-
echo "${{ steps.publish_release.outputs.error_message }}"
238-
exit 1
102+
ensure_tag
103+
upsert_release

0 commit comments

Comments
 (0)