Skip to content

Commit 3a5d7b3

Browse files
committed
fix workspace deployment license and source selection
1 parent dd48b03 commit 3a5d7b3

8 files changed

Lines changed: 60 additions & 37 deletions

File tree

.github/workflows/push.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
release_tag:
7-
description: Existing stable Workspace release tag in vX.Y.Z form
7+
description: Optional existing stable Workspace release tag in vX.Y.Z form
88
type: string
9-
required: true
9+
required: false
1010

1111
environment:
1212
description: 'Environment to run deploy'
@@ -38,6 +38,8 @@ jobs:
3838
name: BuildDockerImage
3939
runs-on: ${{ inputs.runner-name == 'github-runner' && 'ubuntu-latest' || inputs.runner-name }}
4040
environment: ${{ inputs.environment }}
41+
outputs:
42+
image_tag: ${{ steps.release.outputs.image_tag }}
4143
env:
4244
GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
4345
CR: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
@@ -49,29 +51,35 @@ jobs:
4951
with:
5052
fetch-depth: 0
5153
persist-credentials: false
52-
ref: refs/tags/${{ inputs.release_tag }}
54+
ref: ${{ inputs.release_tag == '' && github.sha || format('refs/tags/{0}', inputs.release_tag) }}
5355

54-
- name: Validate release tag
56+
- name: Resolve deployment source
5557
id: release
5658
shell: bash
5759
env:
5860
BASE_BRANCH: ${{ github.event.repository.default_branch }}
61+
DISPATCH_SHA: ${{ github.sha }}
5962
RELEASE_TAG: ${{ inputs.release_tag }}
6063
run: |
6164
set -euo pipefail
62-
if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
63-
echo "release_tag must use stable vX.Y.Z form" >&2
64-
exit 1
65-
fi
66-
if [[ "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")" != "$(git rev-parse HEAD)" ]]; then
67-
echo "Checkout does not match release tag $RELEASE_TAG" >&2
68-
exit 1
69-
fi
70-
if ! git merge-base --is-ancestor HEAD "refs/remotes/origin/$BASE_BRANCH"; then
71-
echo "Release tag commit must be contained in origin/$BASE_BRANCH" >&2
72-
exit 1
65+
if [[ -n "$RELEASE_TAG" ]]; then
66+
if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
67+
echo "release_tag must use stable vX.Y.Z form" >&2
68+
exit 1
69+
fi
70+
if [[ "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")" != "$(git rev-parse HEAD)" ]]; then
71+
echo "Checkout does not match release tag $RELEASE_TAG" >&2
72+
exit 1
73+
fi
74+
if ! git merge-base --is-ancestor HEAD "refs/remotes/origin/$BASE_BRANCH"; then
75+
echo "Release tag commit must be contained in origin/$BASE_BRANCH" >&2
76+
exit 1
77+
fi
78+
IMAGE_TAG="$RELEASE_TAG"
79+
else
80+
IMAGE_TAG="sha-$DISPATCH_SHA"
7381
fi
74-
echo "image_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
82+
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
7583
7684
- uses: ./.github/actions/setup
7785
id: setup
@@ -82,6 +90,7 @@ jobs:
8290
- name: Build and Push Image
8391
env:
8492
IMAGE_TAG: ${{ steps.release.outputs.image_tag }}
93+
UNIVER_WORKSPACE_BROWSER_LICENSE: ${{ secrets.UNIVER_WORKSPACE_BROWSER_LICENSE }}
8594
run: |
8695
make push_image "IMAGE_TAG=$IMAGE_TAG" "CR=$CR"
8796
@@ -92,12 +101,8 @@ jobs:
92101
environment: ${{ inputs.environment }}
93102
env:
94103
CR: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
104+
IMAGE_TAG: ${{ needs.build-docker-image.outputs.image_tag }}
95105
steps:
96-
- name: Set IMAGE_TAG environment variable
97-
env:
98-
RELEASE_TAG: ${{ inputs.release_tag }}
99-
run: echo "IMAGE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
100-
101106
- name: Set FEATURE environment variable
102107
if: ${{ startsWith(inputs.environment, 'feature') }}
103108
run: echo "FEATURE=$(echo ${GITHUB_REF#refs/heads/feat/})" >> "$GITHUB_ENV"

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ pnpm update:sdk --sdk_version <exact-sdk-version>
8989
发布前必须检查整个 workspace 的单一 SDK baseline;`dev` 明确跳过该检查。
9090
- CLI package artifact 必须只包含运行所需代码、资源和版本匹配的 Skills,不得依赖当前 checkout。
9191
- `packages/reference-provider` 不增加独立发布、版本或外部 consumer 合同。
92-
- 稳定 `vX.Y.Z` tag 是 CLI release 与 Workspace deployment 共享的不可变源码坐标;tag push 只发布
93-
CLI,部署 workflow 只手动部署所选 tag。Docker image 和 CLI artifact 的交付时机与执行流程仍然独立。
92+
- 稳定 `vX.Y.Z` tag 在被选择时是 CLI release 与 Workspace deployment 共享的不可变源码坐标;tag push
93+
只发布 CLI。部署 workflow 也可以不选 tag,改为手动部署 workflow dispatch 的精确 commit,并使用
94+
`sha-<commit>` image tag。Docker image 和 CLI artifact 的交付时机与执行流程仍然独立。
9495
- 当前 release workflow 只写 insider-npm;公开 npm Promotion 属于独立后续工作,不得加入该 workflow。
9596

9697
## 文档维护

DREAMNUM.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@
6868
persisted login session and does not pass a browser cookie, password, or OAuth access token through the agent.
6969
- OAuth secrets, trusted Bot credentials, registry credentials, production licenses, and deployment credentials are
7070
environment or build configuration and must not be committed to the repository.
71-
- Stable `vX.Y.Z` tags are immutable source coordinates shared by the stable CLI release and manually selected
72-
Workspace deployments. Tag push publishes only the CLI; deployment remains a separate manual workflow.
73-
- Production images use the selected release tag and are handed off to the private deployment repository; database
74-
migration and rollout ordering remain part of the Workspace application contract.
71+
- Stable `vX.Y.Z` tags are immutable source coordinates shared by the stable CLI release and Workspace deployments
72+
that select a release tag. Tag push publishes only the CLI; deployment remains a separate manual workflow.
73+
- Workspace images use either the selected release tag or `sha-<commit>` for an untagged workflow dispatch and are
74+
handed off to the private deployment repository; database migration and rollout ordering remain part of the
75+
Workspace application contract.
7576

7677
## Update contract
7778

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ IMAGE_TAG ?= latest
66
IMAGE_DIR = ./apps/workspace
77

88
push_image:
9-
@docker build -f $(IMAGE_DIR)/Dockerfile -t $(CR)/$(NS)/$(REPOSITORY):$(IMAGE_TAG) . --push
9+
@docker build --build-arg VITE_UNIVER_LICENSE="$${UNIVER_WORKSPACE_BROWSER_LICENSE}" -f $(IMAGE_DIR)/Dockerfile -t $(CR)/$(NS)/$(REPOSITORY):$(IMAGE_TAG) . --push

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ that graph check. All three paths build, verify, install, and smoke-test the act
8484
tarball before publication. This workflow ends at insider-npm and does not perform a
8585
Public Registry Promotion.
8686

87-
Workspace deployment is a separate manual workflow. It requires an existing stable
88-
`vX.Y.Z` release tag, builds that exact commit, pushes an image with the same tag, and
89-
hands the image to the selected deployment environment. Pushing the tag does not deploy
90-
the server.
87+
Workspace deployment is a separate manual workflow. It can build a selected existing
88+
stable `vX.Y.Z` release tag and use that tag for the image, or, when no release tag is
89+
provided, build the workflow dispatch commit and tag the image as `sha-<commit>`. It
90+
hands the resulting image to the selected deployment environment. Pushing a tag does
91+
not deploy the server.
9192

9293
## Runtime development license
9394

apps/workspace/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ For a V6 rollout, stop every old Workspace instance, start one V6 instance and
178178
wait for migration and health checks to succeed, then restore normal service;
179179
do not let V5 and V6 processes write the same SQLite file concurrently.
180180

181-
The manual `Deploy Workspace` workflow requires an existing stable `vX.Y.Z`
182-
repository tag. It checks out that exact tag, builds and pushes the container image
183-
with the same tag, and hands it to the selected environment. A tag push does not deploy
184-
Workspace automatically, and the deployment workflow does not publish the CLI.
181+
The manual `Deploy Workspace` workflow accepts an optional existing stable `vX.Y.Z`
182+
repository tag. When provided, it checks out that tag and uses it for the container
183+
image. When omitted, it builds the workflow dispatch commit and tags the image as
184+
`sha-<commit>`. It then hands the image to the selected environment. A tag push does
185+
not deploy Workspace automatically, and the deployment workflow does not publish the
186+
CLI.
185187

186188
## Commands
187189

apps/workspace/docs/adr/0005-use-one-stable-source-tag-with-independent-delivery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
status: accepted
2+
status: superseded by ADR-0006
33
---
44

55
# Use one stable source tag with independent delivery
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
status: accepted
3+
---
4+
5+
# Allow untagged Workspace deployments
6+
7+
The manual Workspace deployment workflow accepts an optional stable `vX.Y.Z` release
8+
tag. When a tag is provided, the workflow retains the shared release coordinate from
9+
ADR-0005 and uses that tag for the container image. When it is omitted, the workflow
10+
builds the exact commit selected by the workflow dispatch and uses `sha-<commit>` as
11+
the immutable image tag. CLI publication remains tag-driven and independent from
12+
Workspace deployment. This supersedes ADR-0005 while preserving its tagged release
13+
behavior as one of the two supported deployment source modes.

0 commit comments

Comments
 (0)