-
-
Notifications
You must be signed in to change notification settings - Fork 3
163 lines (154 loc) · 5.98 KB
/
Copy pathrelease.yml
File metadata and controls
163 lines (154 loc) · 5.98 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version bump (major, minor, patch, premajor, preminor, prepatch, or explicit version)"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
concurrency:
group: release
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.DEPLOY_PAT }}
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Configure Git
run: |
git config user.name "Mohamad Omar Nachawati"
git config user.email "mnachawa@gmail.com"
- name: Cache MSL
uses: actions/cache@v4
with:
path: scripts/ModelicaStandardLibrary_v4.1.0.zip
key: ${{ runner.os }}-msl-v4.1.0
- name: Install Dependencies
run: npm ci
env:
CXXFLAGS: "-std=c++20"
- name: Download MSL
run: node scripts/download-msl.cjs
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Lint
run: npm run lint
# --- Version, Changelog, Tag ---
- name: Version & Changelog
run: npx nx release --skip-publish ${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
run: npx nx release publish --yes
env:
NPM_CONFIG_PROVENANCE: true
# --- Publish VS Code Extension ---
- name: Sync VS Code Extension Version
run: npm pkg set version=$(node -p 'require("./packages/core/package.json").version') --workspace=extensions/vscode
- name: Package VS Code Extension
run: npx @vscode/vsce package --no-dependencies
working-directory: extensions/vscode
- name: Upload VSIX Artifact
uses: actions/upload-artifact@v4
with:
name: modelscript-vsix
path: extensions/vscode/*.vsix
- name: Publish to VS Code Marketplace
run: npx @vscode/vsce publish --no-dependencies -p ${{ secrets.VSCE_PAT }}
working-directory: extensions/vscode
- name: Publish to Open VSX
run: npx ovsx publish *.vsix -p ${{ secrets.OVSX_PAT }}
working-directory: extensions/vscode
# --- Deploy Apps (Morsel, IDE) ---
- name: SPA fallback for Morsel
run: cp apps/morsel/build/client/index.html apps/morsel/build/client/404.html
- name: Deploy Morsel
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MODELSCRIPT_MORSEL_DEPLOY_PAT }}
external_repository: modelscript-morsel/modelscript-morsel.github.io
publish_dir: ./apps/morsel/build/client
- name: Cache WebLLM Model
id: cache-model
uses: actions/cache@v4
with:
path: apps/ide/models
key: ${{ runner.os }}-qwen3-0.6b-q4f16_1-mlc-v2
- name: Download WebLLM Model
if: steps.cache-model.outputs.cache-hit != 'true'
run: bash apps/ide/scripts/download-model.sh
- name: Build IDE Static
run: npm run build-static --workspace=@modelscript/ide
- name: Copy model to IDE static output
run: |
mkdir -p apps/ide/dist/static/api/models/Qwen3-0.6B-q4f16_1-MLC/resolve/main
cp apps/ide/models/Qwen3-0.6B-q4f16_1-ctx4k_cs1k-webgpu.wasm apps/ide/dist/static/api/models/
cp apps/ide/models/Qwen3-0.6B-q4f16_1-MLC/*.json apps/ide/dist/static/api/models/Qwen3-0.6B-q4f16_1-MLC/resolve/main/
cp apps/ide/models/Qwen3-0.6B-q4f16_1-MLC/*.bin apps/ide/dist/static/api/models/Qwen3-0.6B-q4f16_1-MLC/resolve/main/
cp apps/ide/models/Qwen3-0.6B-q4f16_1-MLC/*.txt apps/ide/dist/static/api/models/Qwen3-0.6B-q4f16_1-MLC/resolve/main/ 2>/dev/null || true
- name: Deploy IDE
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.MODELSCRIPT_IDE_DEPLOY_PAT }}
external_repository: modelscript-ide/modelscript-ide.github.io
publish_dir: ./apps/ide/dist/static
# --- Publish Docker images to GHCR ---
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from package.json
id: version
run: echo "version=$(node -p 'require("./packages/core/package.json").version')" >> "$GITHUB_OUTPUT"
- name: Build and push Docker images
uses: docker/bake-action@v6
with:
source: .
files: docker-compose.yml
push: true
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.PREBUILT=true
api.tags=ghcr.io/modelscript/api:latest
api.tags=ghcr.io/modelscript/api:${{ steps.version.outputs.version }}
morsel.tags=ghcr.io/modelscript/morsel:latest
morsel.tags=ghcr.io/modelscript/morsel:${{ steps.version.outputs.version }}
web.tags=ghcr.io/modelscript/web:latest
web.tags=ghcr.io/modelscript/web:${{ steps.version.outputs.version }}
ide.tags=ghcr.io/modelscript/ide:latest
ide.tags=ghcr.io/modelscript/ide:${{ steps.version.outputs.version }}
# --- Push version commits and tags ---
- name: Push changes
run: git push --follow-tags