mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix(release): reuse CLI tarball for Docker publishing
This commit is contained in:
1 parent
45cfe87037
commit
a67e38b816
2 files changed
+30
-26
No files matched your search
@@ -9,10 +9,13 @@ ENV CHATLAB_NLP_DICT_DIR=/opt/chatlab/nlp
|
||||
ADD --checksum=sha256:139519822fe8ab9e10d9d07e68ea0451045380aedaf54ecc51e2a28c6b42a13f --chmod=0644 \
|
||||
https://chatlab.fun/assets/nlp/zh-CN.dict /opt/chatlab/nlp/zh-CN.dict
|
||||
|
||||
COPY chatlab-cli-${CHATLAB_VERSION}.tgz /tmp/chatlab-cli.tgz
|
||||
|
||||
RUN test -n "$CHATLAB_VERSION" \
|
||||
&& apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends g++ make python3 \
|
||||
&& npm install --global --omit=dev "chatlab-cli@${CHATLAB_VERSION}" \
|
||||
&& npm install --global --omit=dev /tmp/chatlab-cli.tgz \
|
||||
&& rm /tmp/chatlab-cli.tgz \
|
||||
&& CHATLAB_SKIP_UPDATE_CHECK=1 clb runtime install local-embedding \
|
||||
&& npm cache clean --force \
|
||||
&& apt-get purge --yes --auto-remove g++ make python3 \
|
||||
|
||||
@@ -547,15 +547,30 @@ jobs:
|
||||
name: ChatLab-cli-build
|
||||
path: apps/cli
|
||||
|
||||
- name: Copy README for npm publish
|
||||
run: cp README.md apps/cli/README.md
|
||||
- name: Prepare package documentation
|
||||
run: node apps/cli/scripts/sync-release-docs.mjs
|
||||
|
||||
- name: Pack CLI release
|
||||
working-directory: apps/cli
|
||||
run: npm pack --ignore-scripts
|
||||
|
||||
- name: Upload CLI package
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: ChatLab-cli-package
|
||||
path: apps/cli/chatlab-cli-${{ needs.prepare_release.outputs.version }}.tgz
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: apps/cli
|
||||
run: npm publish --ignore-scripts --provenance --tag ${{ needs.prepare_release.outputs.npm_tag }}
|
||||
env:
|
||||
CHATLAB_VERSION: ${{ needs.prepare_release.outputs.version }}
|
||||
NPM_TAG: ${{ needs.prepare_release.outputs.npm_tag }}
|
||||
run: npm publish "./chatlab-cli-${CHATLAB_VERSION}.tgz" --ignore-scripts --provenance --tag "$NPM_TAG"
|
||||
|
||||
publish-docker:
|
||||
# The image installs the published npm package and does not consume desktop release artifacts.
|
||||
# Install the exact tarball sent to npm without waiting for registry propagation.
|
||||
needs: [prepare_release, publish-cli]
|
||||
if: needs.prepare_release.outputs.is_prerelease == 'false'
|
||||
runs-on: ubuntu-latest
|
||||
@@ -565,29 +580,15 @@ jobs:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Wait for npm package availability
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
env:
|
||||
CHATLAB_VERSION: ${{ needs.prepare_release.outputs.version }}
|
||||
run: |
|
||||
for attempt in {1..30}; do
|
||||
published_version="$(npm view "chatlab-cli@${CHATLAB_VERSION}" version --registry=https://registry.npmjs.org --prefer-online --fetch-timeout=10000 --fetch-retries=0 2>/dev/null || true)"
|
||||
if [ "$published_version" = "$CHATLAB_VERSION" ]; then
|
||||
echo "chatlab-cli@${CHATLAB_VERSION} is available on npm"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Waiting for chatlab-cli@${CHATLAB_VERSION} to become available on npm (${attempt}/30)"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
echo "::error::chatlab-cli@${CHATLAB_VERSION} was not available on npm after 5 minutes"
|
||||
exit 1
|
||||
|
||||
- name: Checkout image definition
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Download CLI package
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: ChatLab-cli-package
|
||||
path: .github/docker
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
@@ -617,7 +618,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
context: .github/docker
|
||||
file: .github/docker/chatlab-cli.Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
Reference in new issue
Block a user