Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adding better release script #688

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ concurrency:
cancel-in-progress: true

permissions:
contents: read
contents: write
id-token: write

env:
DEBUG: napi:*
APP_NAME: baml
MACOSX_DEPLOYMENT_TARGET: "10.13"
jobs:
build-wasm:
runs-on: ubuntu-latest
Expand All @@ -39,7 +42,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18
node-version: 20
cache-dependency-path: |
typescript/**/pnpm-lock.yaml
- name: Install Dependencies
Expand All @@ -63,27 +66,31 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: baml-vscode.vsix
path: typescript/vscode-ext/packages/baml-${{ steps.build.outputs.version }}.vsix
path: typescript/vscode-ext/packages/baml-extension-${{ steps.build.outputs.version }}.vsix
if-no-files-found: error

# Upload the artifact (helpful for debugging and manual downloads)
- name: Upload VSCode Extension Artifact
uses: actions/upload-artifact@v4
with:
name: baml-out
path: typescript/vscode-ext/packages/vscode/out
if-no-files-found: error

# upload the lang server artifact
- name: Upload VSCode Lang Server Extension Artifact
uses: actions/upload-artifact@v4
with:
name: language-server
path: typescript/vscode-ext/packages/language-server/out
if-no-files-found: error

- name: VSCode Playground Artifact
uses: actions/upload-artifact@v4
with:
name: vscode-playground
path: typescript/vscode-ext/packages/web-panel/dist
if-no-files-found: error

build-release:
strategy:
Expand Down Expand Up @@ -135,7 +142,6 @@ jobs:
cache: pnpm
cache-dependency-path: |
engine/language_client_typescript/pnpm-lock.yaml
typescript/**/pnpm-lock.yaml
# Install rust
- uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -206,8 +212,9 @@ jobs:
python-version: "3.8"
- uses: actions/download-artifact@v4
with:
name: wheels-*
pattern: wheels-*

- run: mkdir dist && mv wheels-*/* dist
# authz is managed via OIDC configured at https://pypi.org/manage/project/baml-py/settings/publishing/
# it is pinned to this github actions filename, so renaming this file is not safe!!
- name: Publish package to PyPI
Expand All @@ -218,6 +225,8 @@ jobs:
environment: release
needs: [build-release, build-wasm]
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -245,7 +254,8 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: bindings-*
pattern: bindings-*
path: engine/language_client_typescript/artifacts

- name: create npm dirs
run: pnpm napi create-npm-dirs
Expand All @@ -259,6 +269,7 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/tags/test-release') }}
run: |
npm publish --access public
working-directory: engine/language_client_typescript
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down Expand Up @@ -290,15 +301,21 @@ jobs:
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: vscode-playground
pattern: vscode-playground
path: typescript/vscode-ext/packages/web-panel/dist

- name: setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9.0.6
package_json_file: typescript/package.json
run_install: false
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18
node-version: 20
cache-dependency-path: typescript/pnpm-lock.yaml

- name: Install Dependencies
Expand All @@ -307,7 +324,7 @@ jobs:
- name: Publish
if: ${{ !startsWith(github.ref, 'refs/tags/test-release') }}
run: |
pnpm run vscode:publish --pre-release --no-git-tag-version -p ${{ secrets.VSCODE_PAT }}
pnpm run vscode:publish --no-git-tag-version -p ${{ secrets.VSCODE_PAT }}
working-directory: typescript/vscode-ext/packages

release-github:
Expand Down
6 changes: 3 additions & 3 deletions engine/language_client_typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"node-addon-api"
],
"bin": {
"baml-cli": "./cli.js"
"baml-cli": "cli.js"
},
"files": [
"./cli.js",
Expand Down Expand Up @@ -61,13 +61,13 @@
"format": "run-p format:biome format:rs format:toml",
"format:biome": "biome --write .",
"format:rs": "cargo fmt",
"prepublishOnly": "napi prepublish -t npm",
"prepublishOnly": "napi prepublish --no-gh-release",
"test": "echo no tests implemented",
"version": "napi version"
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@napi-rs/cli": "^3.0.0-alpha.54",
"@napi-rs/cli": "3.0.0-alpha.54",
"@types/node": "^20.12.11",
"npm-run-all2": "^6.1.2",
"ts-node": "^10.9.2",
Expand Down
12 changes: 1 addition & 11 deletions engine/language_client_typescript/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading