Skip to content

Commit 57fa30f

Browse files
jet-pangclaude
andcommitted
chore: translate Chinese comments to English and publish to GitHub Releases
- Translate all Chinese comments and @DisplayName annotations to English in test files (CKEditorConfigTest, ContentManagerTest, EnterpriseEventTest, EnumParserTest, EventDispatcherTest, UploadManagerTest, VaadinCKEditorIntegrationTest) - Update publish workflow to create GitHub Releases instead of publishing to Vaadin Directory (which had auth key issues) - Add draft and prerelease options to publish workflow - Auto-generate release notes with Maven installation instructions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1031ceb commit 57fa30f

File tree

7 files changed

+293
-292
lines changed

7 files changed

+293
-292
lines changed

.github/workflows/publish.yml

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to Vaadin Directory
1+
name: Publish Release
22

33
on:
44
push:
@@ -10,19 +10,24 @@ on:
1010
description: "Version to publish (e.g. 5.0.2) - required for manual trigger"
1111
type: string
1212
required: true
13-
publish:
14-
description: "Automatically publish new version"
13+
draft:
14+
description: "Create as draft release"
1515
type: boolean
16-
required: true
17-
default: true
16+
required: false
17+
default: false
18+
prerelease:
19+
description: "Mark as pre-release"
20+
type: boolean
21+
required: false
22+
default: false
1823
releaseNotes:
1924
description: "Release notes for this version"
2025
type: string
2126
required: false
2227
default: ""
2328

2429
permissions:
25-
contents: read
30+
contents: write
2631

2732
jobs:
2833
publish:
@@ -56,44 +61,26 @@ jobs:
5661
echo "::error::Invalid version format. Expected: X.Y.Z (e.g. 5.0.2)"
5762
exit 1
5863
fi
64+
TAG_NAME="v${VERSION}"
5965
else
6066
# Tag trigger: extract from tag name
6167
if [[ "${GITHUB_REF_TYPE}" != "tag" ]]; then
6268
echo "::error::This workflow must run on a tag ref (v*)."
6369
exit 1
6470
fi
65-
RAW="${GITHUB_REF_NAME}"
66-
if [[ ! "$RAW" =~ ^v[0-9] ]]; then
71+
TAG_NAME="${GITHUB_REF_NAME}"
72+
if [[ ! "$TAG_NAME" =~ ^v[0-9] ]]; then
6773
echo "::error::Tag must start with v followed by version (e.g. v5.0.2)."
6874
exit 1
6975
fi
70-
VERSION="${RAW#v}"
76+
VERSION="${TAG_NAME#v}"
7177
fi
7278
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
79+
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
7380
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
81+
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV"
7482
echo "Resolved version: $VERSION"
75-
76-
- name: Resolve publish parameters
77-
id: params
78-
env:
79-
INPUT_PUBLISH: ${{ inputs.publish }}
80-
INPUT_NOTES: ${{ inputs.releaseNotes }}
81-
run: |
82-
set -euo pipefail
83-
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
84-
PUBLISH="${INPUT_PUBLISH}"
85-
NOTES="${INPUT_NOTES}"
86-
else
87-
# Tag push defaults to publish=true
88-
PUBLISH="true"
89-
NOTES="Release ${VERSION}"
90-
fi
91-
echo "publish=$PUBLISH" >> "$GITHUB_OUTPUT"
92-
printf "notes=%s\n" "$NOTES" >> "$GITHUB_OUTPUT"
93-
echo "PUBLISH=$PUBLISH" >> "$GITHUB_ENV"
94-
printf "NOTES=%s\n" "$NOTES" >> "$GITHUB_ENV"
95-
echo "Publish: $PUBLISH"
96-
echo "Release notes: $NOTES"
83+
echo "Tag name: $TAG_NAME"
9784
9885
- name: Build directory artifact
9986
run: mvn -B -ntp clean install -Pdirectory
@@ -111,64 +98,78 @@ jobs:
11198
echo "Artifact verified: $ARTIFACT"
11299
ls -lh "$ARTIFACT"
113100
114-
- name: Upload artifact to GitHub
115-
uses: actions/upload-artifact@v4
116-
with:
117-
name: ckeditor-vaadin-${{ steps.version.outputs.version }}
118-
path: target/ckeditor-vaadin-${{ steps.version.outputs.version }}.zip
119-
retention-days: 90
120-
121-
- name: Publish to Vaadin Directory
101+
- name: Generate release notes
102+
id: notes
122103
env:
123-
VAADIN_AUTH_KEY: ${{ secrets.VAADIN_AUTH_KEY }}
104+
INPUT_NOTES: ${{ inputs.releaseNotes }}
124105
run: |
125106
set -euo pipefail
107+
if [[ -n "${INPUT_NOTES:-}" ]]; then
108+
NOTES="${INPUT_NOTES}"
109+
else
110+
NOTES="## CKEditor for Vaadin ${VERSION}
126111
127-
if [[ -z "${VAADIN_AUTH_KEY:-}" ]]; then
128-
echo "::error::VAADIN_AUTH_KEY secret is not configured."
129-
exit 1
130-
fi
112+
### Installation
131113
132-
# URL encode release notes
133-
ENCODED_NOTES="$(python3 -c "import urllib.parse, os; print(urllib.parse.quote(os.environ.get('NOTES', ''), safe=''))")"
114+
Add to your \`pom.xml\`:
115+
\`\`\`xml
116+
<dependency>
117+
<groupId>com.wontlost</groupId>
118+
<artifactId>ckeditor-vaadin</artifactId>
119+
<version>${VERSION}</version>
120+
</dependency>
121+
\`\`\`
134122
135-
echo "Uploading to Vaadin Directory..."
136-
echo " Version: ${VERSION}"
137-
echo " Publish: ${PUBLISH}"
138-
echo " Notes: ${NOTES}"
123+
### Downloads
124+
- **ckeditor-vaadin-${VERSION}.zip** - Complete distribution with sources and javadoc
139125
140-
HTTP_CODE=$(curl -s -o response.txt -w "%{http_code}" \
141-
--retry 3 --retry-all-errors \
142-
-X POST "https://vaadin.com/vaadincom/directory-service/upload/ckeditorvaadin?authKey=${VAADIN_AUTH_KEY}&publish=${PUBLISH}&releaseNotes=${ENCODED_NOTES}" \
143-
-H "accept: */*" \
144-
-H "Content-Type: multipart/form-data" \
145-
-F "file=@${ARTIFACT};type=application/zip")
126+
See [CHANGELOG.md](https://github.com/wontlost-ltd/vaadin-ckeditor/blob/main/CHANGELOG.md) for details."
127+
fi
128+
# Use heredoc for multiline output
129+
{
130+
echo "notes<<EOF"
131+
echo "$NOTES"
132+
echo "EOF"
133+
} >> "$GITHUB_OUTPUT"
146134
147-
echo "HTTP response code: $HTTP_CODE"
135+
- name: Create GitHub Release
136+
uses: softprops/action-gh-release@v2
137+
with:
138+
tag_name: ${{ steps.version.outputs.tag_name }}
139+
name: v${{ steps.version.outputs.version }}
140+
body: ${{ steps.notes.outputs.notes }}
141+
draft: ${{ inputs.draft || false }}
142+
prerelease: ${{ inputs.prerelease || false }}
143+
files: |
144+
target/ckeditor-vaadin-${{ steps.version.outputs.version }}.zip
145+
target/ckeditor-vaadin-${{ steps.version.outputs.version }}.jar
146+
target/ckeditor-vaadin-${{ steps.version.outputs.version }}-sources.jar
147+
target/ckeditor-vaadin-${{ steps.version.outputs.version }}-javadoc.jar
148+
fail_on_unmatched_files: false
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148151

149-
if [[ "$HTTP_CODE" -ge 200 && "$HTTP_CODE" -lt 300 ]]; then
150-
echo "Upload successful!"
151-
cat response.txt || true
152-
else
153-
echo "::error::Upload failed with HTTP $HTTP_CODE"
154-
cat response.txt || true
155-
exit 1
156-
fi
152+
- name: Upload artifact
153+
uses: actions/upload-artifact@v4
154+
with:
155+
name: ckeditor-vaadin-${{ steps.version.outputs.version }}
156+
path: target/ckeditor-vaadin-${{ steps.version.outputs.version }}.zip
157+
retention-days: 90
157158

158159
- name: Job Summary
159160
if: always()
160161
run: |
161162
{
162-
echo "## Publish Summary"
163+
echo "## Release Summary"
163164
echo ""
164165
echo "| Parameter | Value |"
165166
echo "|-----------|-------|"
166167
echo "| Version | \`${VERSION:-n/a}\` |"
168+
echo "| Tag | \`${TAG_NAME:-n/a}\` |"
167169
echo "| Artifact | \`${ARTIFACT:-n/a}\` |"
168-
echo "| Publish | \`${PUBLISH:-n/a}\` |"
169170
echo "| Status | \`${{ job.status }}\` |"
170171
echo ""
171172
if [[ "${{ job.status }}" == "success" ]]; then
172-
echo "Published to [Vaadin Directory](https://vaadin.com/directory/component/ckeditor-for-vaadin)"
173+
echo "Released to [GitHub Releases](https://github.com/${{ github.repository }}/releases/tag/${TAG_NAME})"
173174
fi
174175
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)