-
Notifications
You must be signed in to change notification settings - Fork 78
75 lines (63 loc) · 2.28 KB
/
publish-types.yml
File metadata and controls
75 lines (63 loc) · 2.28 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
name: Publish Types to npm
on:
push:
branches:
- npm
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g. 0.14.0)'
required: true
jobs:
publish-types:
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Cache OpenAPI spec
if: github.event_name == 'push'
id: cache-openapi
uses: actions/cache@v4
with:
path: landscape-types/openapi.json
key: openapi-spec-${{ hashFiles('Cargo.lock') }}-${{ github.sha }}
restore-keys: |
openapi-spec-${{ hashFiles('Cargo.lock') }}-
openapi-spec-
- name: Install system dependencies
if: steps.cache-openapi.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y cmake clang curl gcc llvm make pkg-config libelf-dev libclang-dev zlib1g-dev
- name: Setup Rust
if: steps.cache-openapi.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@stable
- name: Generate OpenAPI spec
if: steps.cache-openapi.outputs.cache-hit != 'true'
run: cargo test -p landscape-webserver export_openapi_json -- --nocapture
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Install dependencies & generate types
run: |
pnpm install --frozen-lockfile
pnpm --filter @landscape-router/types generate
- name: Set version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
BASE=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "landscape-webserver") | .version')
VERSION="${BASE}-build.${{ github.run_id }}"
fi
cd landscape-types
pnpm pkg set version="$VERSION"
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
pnpm --filter @landscape-router/types publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}