From dd0f40559dd39a7893559736ec4aa98faf916090 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 14:59:54 -0500 Subject: [PATCH 01/20] added github action file' --- .github/workflows/openapi-generator.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/openapi-generator.yml diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml new file mode 100644 index 0000000000..db429a4129 --- /dev/null +++ b/.github/workflows/openapi-generator.yml @@ -0,0 +1,31 @@ +name: Generate OpenAPI SDK + +on: + workflow_dispatch: + push: + branches: [main] + +jobs: + generate-typescript-axios: + runs-on: ubuntu-latest + name: Example + steps: + # Checkout your code + - name: Checkout + uses: actions/checkout@v2 + + # Generate your OpenAPI document (if you don't write it manually) + + # Use the action to generate a client package + # This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace. + - name: Generate Typescript Axios Client + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: typescript-axios + generator-tag: v6.2.0 + openapi-file: server/immich-openapi-specs.json + + # Do something with the generated client (likely publishing it somewhere) + - name: Do something with the client + run: | + cd typescript-axios-client && ls From fd06aa2135c27d3bdaf25a279d4f035f99ab8425 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:04:24 -0500 Subject: [PATCH 02/20] Add workflow to PR to test --- .github/workflows/openapi-generator.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index db429a4129..20a2e3116b 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -2,6 +2,7 @@ name: Generate OpenAPI SDK on: workflow_dispatch: + pull_request: push: branches: [main] From a94b443f131ae08b06abd84209af1b233a11847c Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:11:09 -0500 Subject: [PATCH 03/20] Push to typescript sdk repo --- .github/workflows/openapi-generator.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 20a2e3116b..0bb34c5266 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -9,7 +9,7 @@ on: jobs: generate-typescript-axios: runs-on: ubuntu-latest - name: Example + name: OpenAPI Generator steps: # Checkout your code - name: Checkout @@ -29,4 +29,4 @@ jobs: # Do something with the generated client (likely publishing it somewhere) - name: Do something with the client run: | - cd typescript-axios-client && ls + cd typescript-axios-client && /bin/sh git_push.sh immich-app typescript-axios-sdk "update" "github.com" From f9af61a5caf74047157fc9438333ed9856df6b31 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:21:17 -0500 Subject: [PATCH 04/20] Manually push to repo --- .github/workflows/openapi-generator.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 0bb34c5266..eb6cdd2220 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -14,8 +14,10 @@ jobs: # Checkout your code - name: Checkout uses: actions/checkout@v2 - - # Generate your OpenAPI document (if you don't write it manually) + run: | + git config --global init.defaultBranch main + git config --global user.email "immichbot@immich.app" + git config --global user.name "Immich Bot" # Use the action to generate a client package # This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace. @@ -29,4 +31,10 @@ jobs: # Do something with the generated client (likely publishing it somewhere) - name: Do something with the client run: | - cd typescript-axios-client && /bin/sh git_push.sh immich-app typescript-axios-sdk "update" "github.com" + cd typescript-axios-client + git init + git add . + git commit -m "Update SDK" + git remote add origin git@github.com:immich-app/typescript-axios-sdk.git + git pull origin main + git push origin main From 6804e3dc736d6632cd093628e0855eb5ce379ef0 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:27:31 -0500 Subject: [PATCH 05/20] Fixed --- .github/workflows/openapi-generator.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index eb6cdd2220..8794105d59 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -14,10 +14,6 @@ jobs: # Checkout your code - name: Checkout uses: actions/checkout@v2 - run: | - git config --global init.defaultBranch main - git config --global user.email "immichbot@immich.app" - git config --global user.name "Immich Bot" # Use the action to generate a client package # This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace. @@ -31,6 +27,9 @@ jobs: # Do something with the generated client (likely publishing it somewhere) - name: Do something with the client run: | + git config --global init.defaultBranch main + git config --global user.email "immichbot@immich.app" + git config --global user.name "Immich Bot" cd typescript-axios-client git init git add . From 3228882fc0f152592d07c1c59d568f614d03b271 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:32:19 -0500 Subject: [PATCH 06/20] Authenticate --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 8794105d59..8845650cd1 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -34,6 +34,6 @@ jobs: git init git add . git commit -m "Update SDK" - git remote add origin git@github.com:immich-app/typescript-axios-sdk.git + git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@$github.com/immich-app/typescript-axios-sdk.git git pull origin main git push origin main From 2cb7517f6493682ed289fab8517ec4c6ce68c2ce Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:33:07 -0500 Subject: [PATCH 07/20] Fix url --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 8845650cd1..17de7d4265 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -34,6 +34,6 @@ jobs: git init git add . git commit -m "Update SDK" - git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@$github.com/immich-app/typescript-axios-sdk.git + git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git git pull origin main git push origin main From 9a6d29d6e740d2be24400e911849d68b733fa268 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:34:42 -0500 Subject: [PATCH 08/20] Add global config for git --- .github/workflows/openapi-generator.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 17de7d4265..8d361256a4 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -28,6 +28,7 @@ jobs: - name: Do something with the client run: | git config --global init.defaultBranch main + git config --global pull.rebase false git config --global user.email "immichbot@immich.app" git config --global user.name "Immich Bot" cd typescript-axios-client From 77312ce2e087e4b9e2968f8132d82434d10fa725 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:37:03 -0500 Subject: [PATCH 09/20] Force push --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 8d361256a4..625739dc5a 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -37,4 +37,4 @@ jobs: git commit -m "Update SDK" git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git git pull origin main - git push origin main + git push origin main --force From 9e54e30011930e0cbd841aae025e7e7c51e1ac31 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:38:38 -0500 Subject: [PATCH 10/20] git push force --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 625739dc5a..08d9d73826 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -37,4 +37,4 @@ jobs: git commit -m "Update SDK" git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git git pull origin main - git push origin main --force + git push origin main 2>&1 | grep -v 'To https' From fc255b558de0586c69f5a559ab408c9a190e7a3f Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:40:01 -0500 Subject: [PATCH 11/20] fix --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 08d9d73826..d1d3dc3334 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -36,5 +36,5 @@ jobs: git add . git commit -m "Update SDK" git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git - git pull origin main + git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' From 0e509ceafa839a7997a51f9f01e287226850c655 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:45:30 -0500 Subject: [PATCH 12/20] Added permissionf or github bot --- .github/workflows/openapi-generator.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index d1d3dc3334..1673e2ca29 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -6,6 +6,9 @@ on: push: branches: [main] +permissions: + repository-projects: write + jobs: generate-typescript-axios: runs-on: ubuntu-latest From fdac5af5eeb54c375ab1cc073dbc1869f9193c02 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:47:47 -0500 Subject: [PATCH 13/20] Added github token --- .github/workflows/openapi-generator.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 1673e2ca29..761f7f3cf1 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -6,9 +6,6 @@ on: push: branches: [main] -permissions: - repository-projects: write - jobs: generate-typescript-axios: runs-on: ubuntu-latest @@ -17,6 +14,7 @@ jobs: # Checkout your code - name: Checkout uses: actions/checkout@v2 + token: ${{ secrets.GH_TOKEN }} # Use the action to generate a client package # This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace. From 0e3fb41e73dc98cb1172af8bf192ef6c88c6cdd0 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 15:48:38 -0500 Subject: [PATCH 14/20] fixed --- .github/workflows/openapi-generator.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 761f7f3cf1..cf49da829f 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -13,8 +13,9 @@ jobs: steps: # Checkout your code - name: Checkout - uses: actions/checkout@v2 - token: ${{ secrets.GH_TOKEN }} + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} # Use the action to generate a client package # This uses the default path for the openapi document and thus assumes there is an openapi.json in the current workspace. From 6355a07dc4b7d085139277b0950d5c07b350d783 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 16:09:15 -0500 Subject: [PATCH 15/20] Added github token custom --- .github/workflows/openapi-generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index cf49da829f..5bb98967be 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -37,6 +37,6 @@ jobs: git init git add . git commit -m "Update SDK" - git remote add origin https://immich-app:"${{ secrets.GITHUB_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git + git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' From c4e32ce159fb55b083850eb9373fe8986c6833ae Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 16:15:36 -0500 Subject: [PATCH 16/20] Rename repo --- .github/workflows/openapi-generator.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 5bb98967be..0f2899dab1 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -31,12 +31,12 @@ jobs: run: | git config --global init.defaultBranch main git config --global pull.rebase false - git config --global user.email "immichbot@immich.app" - git config --global user.name "Immich Bot" + git config --global user.email "alex.tran1502@gmail.com" + git config --global user.name "Alex Tran" cd typescript-axios-client git init git add . git commit -m "Update SDK" - git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/typescript-axios-sdk.git + git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/immich-sdk-typescript-axios.git git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' From c3d7dda61ff6e621f78e02c67839df8d6f959cda Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Thu, 6 Oct 2022 17:23:05 -0500 Subject: [PATCH 17/20] Added generation for dart --- .github/workflows/openapi-generator.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 0f2899dab1..6526726758 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -27,7 +27,7 @@ jobs: openapi-file: server/immich-openapi-specs.json # Do something with the generated client (likely publishing it somewhere) - - name: Do something with the client + - name: Push to typescript repo run: | git config --global init.defaultBranch main git config --global pull.rebase false @@ -40,3 +40,18 @@ jobs: git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/immich-sdk-typescript-axios.git git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' + + - name: Generate Dart Client + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: dart + generator-tag: v6.2.0 + openapi-file: server/immich-openapi-specs.json + + - name: Push to Dart repo + run: | + git config --global init.defaultBranch main + git config --global pull.rebase false + git config --global user.email "alex.tran1502@gmail.com" + git config --global user.name "Alex Tran" + cd dart-client && ls From 17085dd8a014154bcab34e80765f9ff7559e710e Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Fri, 7 Oct 2022 09:39:22 -0500 Subject: [PATCH 18/20] Added SDK to Rust --- .github/workflows/openapi-generator.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 6526726758..d773a20dc1 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -54,4 +54,10 @@ jobs: git config --global pull.rebase false git config --global user.email "alex.tran1502@gmail.com" git config --global user.name "Alex Tran" - cd dart-client && ls + cd dart-client + git init + git add . + git commit -m "Update SDK" + git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/immich-sdk-rust.git + git pull origin main --allow-unrelated-histories + git push origin main 2>&1 | grep -v 'To https' From 14dc6793325e555e997d6d59ae2b4df23d7cb10b Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Fri, 7 Oct 2022 09:46:10 -0500 Subject: [PATCH 19/20] Added SDK to Rust --- .github/workflows/openapi-generator.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index d773a20dc1..7b59ac87be 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -41,7 +41,7 @@ jobs: git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' - - name: Generate Dart Client + - name: Generate Dart SDK uses: openapi-generators/openapitools-generator-action@v1 with: generator: dart @@ -58,6 +58,27 @@ jobs: git init git add . git commit -m "Update SDK" + git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/immich-sdk-dart.git + git pull origin main --allow-unrelated-histories + git push origin main 2>&1 | grep -v 'To https' + + - name: Generate Rust SDK + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: rust + generator-tag: v6.2.0 + openapi-file: server/immich-openapi-specs.json + + - name: Push to Rust repo + run: | + git config --global init.defaultBranch main + git config --global pull.rebase false + git config --global user.email "alex.tran1502@gmail.com" + git config --global user.name "Alex Tran" + cd rust-client + git init + git add . + git commit -m "Update SDK" git remote add origin https://immich-app:"${{ secrets.GH_TOKEN }}"@github.com/immich-app/immich-sdk-rust.git git pull origin main --allow-unrelated-histories git push origin main 2>&1 | grep -v 'To https' From c28863966b658c4c0ed5a1acc7235d0c394045f5 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Fri, 7 Oct 2022 09:50:04 -0500 Subject: [PATCH 20/20] Remove build on PR --- .github/workflows/openapi-generator.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 7b59ac87be..91731a0256 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -2,7 +2,6 @@ name: Generate OpenAPI SDK on: workflow_dispatch: - pull_request: push: branches: [main]