1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

chore: publish sdk on release (#7895)

* chore: publish sdk on release

* fix: runtime dep

* chore: sync versions

* chore: update readme

* fix: use Node16 module resolution
This commit is contained in:
Jason Rasmussen 2024-03-12 12:01:12 -04:00 committed by GitHub
parent 779f5d9b3d
commit 17d7d9364f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 90 additions and 40 deletions

View file

@ -1,26 +0,0 @@
name: Update Immich SDK
on:
workflow_dispatch:
push:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-sdk-repos:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'immich-app',
repo: 'immich-sdk-typescript-axios',
workflow_id: 'build.yml',
ref: 'main'
})

31
.github/workflows/sdk.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Update Immich SDK
on:
release:
types: [published]
permissions:
packages: write
jobs:
publish:
name: Publish `@immich/sdk`
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./open-api/typescript-sdk
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install deps
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

6
cli/package-lock.json generated
View file

@ -49,8 +49,10 @@
"version": "1.98.2", "version": "1.98.2",
"dev": true, "dev": true,
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": {
"@oazapfts/runtime": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"@oazapfts/runtime": "^1.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }
@ -5186,7 +5188,7 @@
"@immich/sdk": { "@immich/sdk": {
"version": "file:../open-api/typescript-sdk", "version": "file:../open-api/typescript-sdk",
"requires": { "requires": {
"@oazapfts/runtime": "^1.0.0", "@oazapfts/runtime": "^1.0.2",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }

6
e2e/package-lock.json generated
View file

@ -38,7 +38,7 @@
}, },
"../cli": { "../cli": {
"name": "@immich/cli", "name": "@immich/cli",
"version": "2.0.8", "version": "2.1.0",
"dev": true, "dev": true,
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": { "dependencies": {
@ -82,8 +82,10 @@
"version": "1.98.2", "version": "1.98.2",
"dev": true, "dev": true,
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": {
"@oazapfts/runtime": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"@oazapfts/runtime": "^1.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }

View file

@ -0,0 +1,3 @@
package-lock.json
tsconfig.json
src/

View file

@ -0,0 +1,28 @@
# @immich/sdk
A TypeScript SDK for interfacing with the [Immich](https://immich.app/) API.
## Install
```bash
npm i --save @immich/sdk
```
## Usage
For a more detailed example, check out the [`@immich/cli`](https://github.com/immich-app/immich/tree/main/cli).
```typescript
import { defaults, getAllAlbums, getAllAssets, getMyUserInfo } from "@immich/sdk";
const API_KEY = "<API_KEY>"; // process.env.IMMICH_API_KEY
defaults.baseUrl = "https://demo.immich.app/api";
defaults.headers = { "x-api-key": API_KEY };
const user = await getMyUserInfo();
const assets = await getAllAssets({ take: 1000 });
const albums = await getAllAlbums({});
console.log({ user, assets, albums });
```

View file

@ -8,8 +8,10 @@
"name": "@immich/sdk", "name": "@immich/sdk",
"version": "1.98.2", "version": "1.98.2",
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": {
"@oazapfts/runtime": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"@oazapfts/runtime": "^1.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }
@ -17,8 +19,7 @@
"node_modules/@oazapfts/runtime": { "node_modules/@oazapfts/runtime": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/@oazapfts/runtime/-/runtime-1.0.2.tgz", "resolved": "https://registry.npmjs.org/@oazapfts/runtime/-/runtime-1.0.2.tgz",
"integrity": "sha512-V33FjR6V+AkGRWYQW3XPm5BLn2loGl2ujSeja1TzdjjEn2zjGgl3ve0dcFf/jEwPZEOqQZl6YwIgIB/clXVqWw==", "integrity": "sha512-V33FjR6V+AkGRWYQW3XPm5BLn2loGl2ujSeja1TzdjjEn2zjGgl3ve0dcFf/jEwPZEOqQZl6YwIgIB/clXVqWw=="
"dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.11.25", "version": "20.11.25",

View file

@ -1,7 +1,7 @@
{ {
"name": "@immich/sdk", "name": "@immich/sdk",
"version": "1.98.2", "version": "1.98.2",
"description": "", "description": "Auto-generated TypeScript SDK for the Immich API",
"type": "module", "type": "module",
"main": "./build/index.js", "main": "./build/index.js",
"types": "./build/index.d.ts", "types": "./build/index.d.ts",
@ -15,9 +15,16 @@
"build": "tsc" "build": "tsc"
}, },
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": {
"@oazapfts/runtime": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"@oazapfts/runtime": "^1.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/immich-app/immich.git",
"directory": "open-api/typescript-sdk"
} }
} }

View file

@ -1,2 +1,2 @@
export * from './fetch-client'; export * from './fetch-client.js';
export * from './fetch-errors'; export * from './fetch-errors.js';

View file

@ -5,8 +5,8 @@
"skipLibCheck": true, "skipLibCheck": true,
"declaration": true, "declaration": true,
"outDir": "build", "outDir": "build",
"module": "esnext", "module": "Node16",
"moduleResolution": "Bundler", "moduleResolution": "Node16",
"lib": ["esnext", "dom"] "lib": ["esnext", "dom"]
}, },
"include": ["src/**/*.ts"] "include": ["src/**/*.ts"]

4
web/package-lock.json generated
View file

@ -65,8 +65,10 @@
"name": "@immich/sdk", "name": "@immich/sdk",
"version": "1.98.2", "version": "1.98.2",
"license": "GNU Affero General Public License version 3", "license": "GNU Affero General Public License version 3",
"dependencies": {
"@oazapfts/runtime": "^1.0.2"
},
"devDependencies": { "devDependencies": {
"@oazapfts/runtime": "^1.0.0",
"@types/node": "^20.11.0", "@types/node": "^20.11.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }