Repository navigation
193 lines (168 loc) · 6.63 KB
/
Copy pathrelease-dev.yml
File metadata and controls
193 lines (168 loc) · 6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Publish dev release
on:
workflow_call:
outputs:
marimo_version:
description: "The dev version that was built"
value: ${{ jobs.publish_dev_release.outputs.marimo_version }}
permissions:
contents: read
env:
TURBO_TEAM: marimo
UV_EXCLUDE_NEWER: "7 days"
jobs:
publish_dev_release:
name: 📤 Build dev release
runs-on: "${{ vars.CI_RUNNER_LARGE || 'ubuntu-latest' }}"
permissions:
contents: read
id-token: write # required for Doppler OIDC
defaults:
run:
shell: bash
outputs:
marimo_version: ${{ steps.get_version.outputs.marimo_version }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
# get tag history for version number
fetch-depth: 0
- name: 🔐 Fetch Doppler secrets
uses: dopplerhq/secrets-fetch-action@cd2efbf9a404504316435873eff298b82f7e0562 # v1.3.0
id: secrets
with:
auth-method: oidc
doppler-identity-id: ${{ vars.DOPPLER_IDENTITY_ID }}
doppler-project: marimo-oss
doppler-config: ci_deploy
- name: 📦 Build frontend
uses: ./.github/actions/build-frontend
with:
turbo-token: ${{ steps.secrets.outputs.TURBO_TOKEN }}
codecov-token: ${{ steps.secrets.outputs.CODECOV_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
# patch pyproject.toml version to be of the form
# X.Y.<Z+1>-dev{n-commits-since-last-tag}
- name: 🔨 Patch version number
id: get_version
run: |
# Get the version number and increment patch
# - assumes version is on a line of the form __version__ == "x.y.z"
incremented_version=$(uv version --short | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}')
# Get the number of commits since last tag
n_commits=$(git rev-list "$(git describe --tags --abbrev=0)..HEAD" --count)
# Form the new version, which is one patch ahead of the last version
# so installing from Test PyPI does the right thing
MARIMO_VERSION="${incremented_version}-dev${n_commits}"
# Set the version in the environment for later steps
echo "MARIMO_VERSION=$MARIMO_VERSION" >> "$GITHUB_ENV"
echo "marimo_version=$MARIMO_VERSION" >> "$GITHUB_OUTPUT"
uv version "$MARIMO_VERSION"
env:
NO_COLOR: 1
- name: 📦 Build marimo
run: uv build
- name: 📦 Upload marimo dist artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: pypi-marimo-dev
path: dist/
retention-days: 1
- name: Clean output dir
run: rm -rf dist
- name: Adapt pyproject.toml to build marimo-base
run: uv run ./scripts/modify_pyproject_for_marimo_base.py
- name: 📦 Build marimo-base
run: uv build
- name: 📦 Validate base wheel size
run: ./scripts/validate_base_wheel_size.sh
- name: 📦 Upload marimo-base dist artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: pypi-marimo-base-dev
path: dist/
retention-days: 1
- name: 📦 Update package.json version from CLI
working-directory: frontend
run: |
echo "Updating package.json version to ${{ env.MARIMO_VERSION }}"
npm version ${{ env.MARIMO_VERSION }} --no-git-tag-version
- name: 📦 Upload frontend artifact for npm publish
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: frontend-dev
path: frontend/
retention-days: 1
- name: 📦 Update package.json name to @marimo-team/islands
working-directory: frontend
run: |
sed -i 's/"name": "@marimo-team\/frontend"/"name": "@marimo-team\/islands"/' package.json
- name: 📦 Rebuild frontend for islands
working-directory: frontend
env:
NODE_ENV: production
VITE_MARIMO_ISLANDS: 'true'
VITE_MARIMO_VERSION: ${{ env.MARIMO_VERSION }}
run: |
pnpm turbo build:islands
./islands/validate.sh
- name: 📦 Upload islands artifact for npm publish
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: frontend-islands-dev
path: frontend/
retention-days: 1
# Recheck after the build completes before publishing to npm. The `dev` dist-tag is
# mutable — if a stale older run publishes after a newer one, `@dev` gets pointed at
# older artifacts. Always runs; returns is_latest=true for non-main callers so this
# reusable workflow stays safe outside the push-to-main path.
recheck_tip_of_main:
name: 🔍 Still tip of main?
needs: publish_dev_release
runs-on: "${{ vars.CI_RUNNER_SMALL || 'ubuntu-latest' }}"
outputs:
is_latest: ${{ steps.check.outputs.is_latest }}
steps:
- id: check
env:
GH_REF: ${{ github.ref }}
GH_SHA: ${{ github.sha }}
GH_REPO: ${{ github.repository }}
run: |
if [ "$GH_REF" != "refs/heads/main" ]; then
echo "is_latest=true" >> "$GITHUB_OUTPUT"
exit 0
fi
LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
if [ "$LATEST_SHA" = "$GH_SHA" ]; then
echo "is_latest=true" >> "$GITHUB_OUTPUT"
else
echo "is_latest=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping npm publish — superseded by a newer commit on main ($LATEST_SHA) during build."
fi
publish_wasm_dev:
name: 📤 Publish @marimo-team/frontend to npm
needs: [publish_dev_release, recheck_tip_of_main]
if: needs.recheck_tip_of_main.outputs.is_latest == 'true'
uses: ./.github/workflows/publish-npm.yml
with:
package-artifact-name: frontend-dev
working-directory: '.'
npm-tag: 'dev'
permissions:
id-token: write # Required for OIDC
contents: read
publish_islands_dev:
name: 📤 Publish @marimo-team/islands to npm
needs: [publish_dev_release, recheck_tip_of_main]
if: needs.recheck_tip_of_main.outputs.is_latest == 'true'
uses: ./.github/workflows/publish-npm.yml
with:
package-artifact-name: frontend-islands-dev
working-directory: '.'
npm-tag: 'dev'
permissions:
id-token: write # Required for OIDC
contents: read