-
Notifications
You must be signed in to change notification settings - Fork 274
221 lines (191 loc) · 6.86 KB
/
release.yml
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: Publish release
# release a new version of marimo on tag push
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch: {}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: marimo
REGISTRY: ghcr.io
IMAGE_NAME: marimo-team/marimo
jobs:
publish_release:
name: 📤 Publish release
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
marimo_version: ${{ steps.get_version.outputs.marimo_version }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 📦 Build frontend
run: make fe
- name: 🐍 Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
# This does not work when running `marimo --version`
# - name: 🐍 Setup uv
# uses: yezz123/setup-uv@v4
# with:
# uv-venv: marimo-venv
- name: 📦 Build marimo
run: |
pip install build twine
pip install .
python -m build
- name: 📤 Upload to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload --skip-existing dist/*
- name: 🔨 Get version
id: get_version
run: |
echo "marimo_version=$(python -m marimo --version)" >> $GITHUB_OUTPUT
- name: 📦 Update package.json version from CLI
working-directory: frontend
run: |
echo "Updating package.json version to ${{ steps.get_version.outputs.marimo_version }}"
npm version ${{ steps.get_version.outputs.marimo_version }} --no-git-tag-version
- name: 📤 Upload wasm to npm
working-directory: frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
- 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
working-directory: frontend
env:
NODE_ENV: production
VITE_MARIMO_ISLANDS: 'true'
VITE_MARIMO_VERSION: ${{ steps.get_version.outputs.marimo_version }}
run: |
pnpm turbo build:islands
./islands/validate.sh
- name: 📤 Upload islands to npm
working-directory: frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
publish_docker:
name: 🐋 Publish Docker images
runs-on: ubuntu-latest
needs: [publish_release]
# Don't error while this is in BETA
continue-on-error: true
permissions:
contents: read
packages: write
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: 🐋 Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🐋 Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: 🐋 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🧪 Build docker image for testing
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
# Don't push test image
push: false
load: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
target: slim
build-args: |
marimo_version=${{ needs.publish_release.outputs.marimo_version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 🧪 Test docker build
run: |
docker run -d -e PORT=9090 -p 9090:9090 --name test_container ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
sleep 2
curl -f http://localhost:9090/health || (docker logs test_container && exit 1)
docker stop test_container
docker rm test_container
- name: 📦 Build and push Docker images (slim)
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.publish_release.outputs.marimo_version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
target: slim
platforms: linux/amd64,linux/arm64
build-args: |
marimo_version=${{ needs.publish_release.outputs.marimo_version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 📦 Build and push Docker images (data)
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.publish_release.outputs.marimo_version }}-data
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-data
target: data
platforms: linux/amd64,linux/arm64
build-args: |
marimo_version=${{ needs.publish_release.outputs.marimo_version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 📦 Build and push Docker images (sql)
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.publish_release.outputs.marimo_version }}-sql
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-sql
target: sql
platforms: linux/amd64,linux/arm64
build-args: |
marimo_version=${{ needs.publish_release.outputs.marimo_version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max