Skip to content

Commit 0dcf61c

Browse files
authored
feat(ci):Add Lite Version Builds (#58)
* [skip ci] style: format code with prettier * ci:add lite version * use working-directory
1 parent a50ce9d commit 0dcf61c

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.github/workflows/build_release.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,23 @@ jobs:
132132
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
133133
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
134134

135+
- name: Checkout lite version code
136+
uses: actions/checkout@v4
137+
with:
138+
ref: lite
139+
path: lite
140+
fetch-depth: 0
141+
submodules: recursive
142+
143+
- name: Build Lite Release
144+
run: |
145+
chmod +x build.sh
146+
./build.sh --release --compress --lite
147+
working-directory: ./lite
148+
env:
149+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
150+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
151+
135152
- name: Upload Release Assets
136153
run: |
137154
# Delete local tag, or gh cli will complain about it.
@@ -141,7 +158,7 @@ jobs:
141158
--notes-file "${{ github.workspace }}-CHANGELOG.txt" \
142159
--prerelease=${{ steps.check_pre_release.outputs.is_pre_release }} \
143160
${{ steps.get_current_tag.outputs.current_tag }} \
144-
dist/openlist-frontend-dist-v*.tar.gz dist/i18n.tar.gz
161+
dist/openlist-frontend-dist-v*.tar.gz lite/dist/openlist-frontend-dist-lite-v*.tar.gz dist/i18n.tar.gz
145162
env:
146163
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147164

@@ -150,6 +167,10 @@ jobs:
150167
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
151168
# Delete the generated dist tarball
152169
rm -f dist/openlist-frontend-dist-v*.tar.gz
170+
rm -f lite/dist/openlist-frontend-dist-lite-v*.tar.gz
171+
# Copy the lite version
172+
mkdir dist/lite
173+
cp lite/dist/* dist/lite/
153174
154175
if ! jq -e '.name and .version' package.json > /dev/null; then
155176
echo "Error: Invalid package.json"

build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ main() {
2525
set_defaults
2626
check_git_version_and_commit
2727
update_package_version
28-
archive_name="openlist-frontend-dist-${version_tag}"
28+
if [[ "$LITE_FLAG" == "true" ]]; then
29+
archive_name="openlist-frontend-dist-lite-${version_tag}"
30+
else
31+
archive_name="openlist-frontend-dist-${version_tag}"
32+
fi
2933
build_project
3034
create_version_file
3135
handle_compression
@@ -42,6 +46,7 @@ parse_args() {
4246
--no-compress) COMPRESS_FLAG="false"; shift ;;
4347
--enforce-tag) ENFORCE_TAG="true"; shift ;;
4448
--skip-i18n) SKIP_I18N="true"; shift ;;
49+
--lite) LITE_FLAG="true"; shift ;;
4550
-h|--help) display_help; exit 0 ;;
4651
*) log_error "Unknown option: $1"; display_help; exit 1 ;;
4752
esac
@@ -50,7 +55,7 @@ parse_args() {
5055

5156
# Display help message
5257
display_help() {
53-
echo "Usage: $0 [--dev|--release] [--compress|--no-compress] [--enforce-tag] [--skip-i18n]"
58+
echo "Usage: $0 [--dev|--release] [--compress|--no-compress] [--enforce-tag] [--skip-i18n] [--lite]"
5459
echo ""
5560
echo "Options (will overwrite environment setting):"
5661
echo " --dev Build development version"
@@ -59,6 +64,7 @@ display_help() {
5964
echo " --no-compress Skip compression"
6065
echo " --enforce-tag Force git tag requirement for both dev and release builds"
6166
echo " --skip-i18n Skip i18n build step"
67+
echo " --lite Add -lite suffix to frontend archive name"
6268
echo ""
6369
echo "Environment variables:"
6470
echo " OPENLIST_FRONTEND_BUILD_MODE=dev|release (default: dev)"
@@ -73,6 +79,7 @@ set_defaults() {
7379
COMPRESS_FLAG=${COMPRESS_FLAG:-${OPENLIST_FRONTEND_BUILD_COMPRESS:-false}}
7480
ENFORCE_TAG=${ENFORCE_TAG:-${OPENLIST_FRONTEND_BUILD_ENFORCE_TAG:-false}}
7581
SKIP_I18N=${SKIP_I18N:-${OPENLIST_FRONTEND_BUILD_SKIP_I18N:-false}}
82+
LITE_FLAG=${LITE_FLAG:-false}
7683
}
7784

7885
# Check git version and commit

src/lang/en/drivers.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,4 +1311,4 @@
13111311
"WoPan": "WoPan",
13121312
"YandexDisk": "YandexDisk"
13131313
}
1314-
}
1314+
}

0 commit comments

Comments
 (0)