mirror of https://github.com/immich-app/immich.git
chore: publish sdk on release (#7895)
* chore: publish sdk on release * fix: runtime dep * chore: sync versions * chore: update readme * fix: use Node16 module resolutionpull/7907/head
parent
779f5d9b3d
commit
17d7d9364f
@ -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'
|
||||
})
|
||||
@ -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 }}
|
||||
@ -0,0 +1,3 @@
|
||||
package-lock.json
|
||||
tsconfig.json
|
||||
src/
|
||||
@ -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 });
|
||||
```
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './fetch-client';
|
||||
export * from './fetch-errors';
|
||||
export * from './fetch-client.js';
|
||||
export * from './fetch-errors.js';
|
||||
|
||||
Loading…
Reference in New Issue