1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31:58 +00:00

feat(cli): auto-release (#10127)

This commit is contained in:
Jason Rasmussen 2024-06-11 09:33:36 -04:00 committed by GitHub
parent eba166a2f1
commit 735455508c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 14 deletions

View file

@ -1,16 +1,17 @@
name: CLI Build name: CLI Build
on: on:
workflow_dispatch:
push: push:
branches: [main] branches: [main]
paths: paths:
- "cli/**" - 'cli/**'
- ".github/workflows/cli.yml" - '.github/workflows/cli.yml'
pull_request: pull_request:
branches: [main] branches: [main]
paths: paths:
- "cli/**" - 'cli/**'
- ".github/workflows/cli.yml" - '.github/workflows/cli.yml'
release:
types: [published]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
@ -32,8 +33,8 @@ jobs:
# Setup .npmrc file to publish to npm # Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: "20.x" node-version: '20.x'
registry-url: "https://registry.npmjs.org" registry-url: 'https://registry.npmjs.org'
- name: Prepare SDK - name: Prepare SDK
run: npm ci --prefix ../open-api/typescript-sdk/ run: npm ci --prefix ../open-api/typescript-sdk/
- name: Build SDK - name: Build SDK
@ -41,7 +42,7 @@ jobs:
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm publish - run: npm publish
if: ${{ github.event_name == 'workflow_dispatch' }} if: ${{ github.event_name == 'release' }}
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@ -83,15 +84,15 @@ jobs:
images: | images: |
name=ghcr.io/${{ github.repository_owner }}/immich-cli name=ghcr.io/${{ github.repository_owner }}/immich-cli
tags: | tags: |
type=raw,value=${{ steps.package-version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }} type=raw,value=${{ steps.package-version.outputs.version }},enable=${{ github.event_name == 'release' }}
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Build and push image - name: Build and push image
uses: docker/build-push-action@v5.4.0 uses: docker/build-push-action@v5.4.0
with: with:
file: cli/Dockerfile file: cli/Dockerfile
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'workflow_dispatch' }} push: ${{ github.event_name == 'release' }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ steps.metadata.outputs.tags }}

View file

@ -66,10 +66,12 @@ if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then
npm --prefix server run build npm --prefix server run build
make open-api make open-api
npm --prefix open-api/typescript-sdk version "$SERVER_PUMP" npm --prefix open-api/typescript-sdk version "$SERVER_PUMP"
npm --prefix web version "$SERVER_PUMP" # TODO use $SERVER_PUMP once we pass 2.2.x
npm --prefix e2e version "$SERVER_PUMP" npm --prefix cli version patch
npm --prefix web i --package-lock-only
npm --prefix cli i --package-lock-only npm --prefix cli i --package-lock-only
npm --prefix web version "$SERVER_PUMP"
npm --prefix web i --package-lock-only
npm --prefix e2e version "$SERVER_PUMP"
npm --prefix e2e i --package-lock-only npm --prefix e2e i --package-lock-only
poetry --directory machine-learning version "$SERVER_PUMP" poetry --directory machine-learning version "$SERVER_PUMP"
fi fi