Skip to content

Commit 5a0111e

Browse files
committed
Merge branch 'refs/heads/feat-cli-g2' into feat-cli-sudo
# Conflicts: # templates/cli/lib/commands/push.js.twig
2 parents 25d7032 + 26054b2 commit 5a0111e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+671
-361
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CLI beta Publish
2+
on:
3+
pull_request:
4+
paths:
5+
- 'templates/cli/**.twig'
6+
- 'src/SDK/Language/CLI.php'
7+
8+
env:
9+
PACKAGE_NAME: "${{ vars.PACKAGE_NAME }}@0.16.0${{ github.event.pull_request.head.sha }}"
10+
11+
jobs:
12+
publish:
13+
environment: cli-testing
14+
permissions:
15+
contents: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v3
20+
- name: Setup Composer dependencies
21+
run: docker run --rm --volume "$(pwd)":/app composer install --ignore-platform-reqs
22+
- name: Generate SDKS
23+
run: docker run --rm -v "$(pwd)":/app -w /app php:8.1-cli php example.php
24+
- name: Fix permission
25+
run: sudo chown -R 1001:1001 examples
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 'latest'
30+
registry-url: 'https://registry.npmjs.org'
31+
- name: Setup
32+
working-directory: ./examples/cli/
33+
run: npm install
34+
- name: Set version
35+
working-directory: ./examples/cli/
36+
run: |
37+
sed -i "s#appwrite-cli#${{ vars.PACKAGE_NAME }}#g" package.json
38+
sed -i "s#0.16.0#0.16.0${{ github.event.pull_request.head.sha }}#g" package.json
39+
- name: Publish
40+
working-directory: examples/cli/
41+
run: npm publish --access public
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
- name: Instruction
45+
run: |
46+
echo "Install it by running npm install ${{ env.PACKAGE_NAME }}"
47+
echo "Run it using npx ${{ env.PACKAGE_NAME }}"

.github/workflows/tests.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,40 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php-version: ['8.2']
16-
sdk: [Android5Java17, Android14Java17, CLINode16, CLINode18, DartBeta, DartStable, Deno1193, Deno1303, DotNet60, DotNet70, FlutterStable, FlutterBeta, Go112, Go118, KotlinJava8, KotlinJava11, KotlinJava17, Node16, Node18, Node20, PHP74, PHP80, Python38, Python39, Python310, Ruby27, Ruby30, Ruby31, AppleSwift56, Swift56, WebChromium, WebNode]
16+
sdk: [
17+
Android5Java17,
18+
Android14Java17,
19+
CLINode16,
20+
CLINode18,
21+
DartBeta,
22+
DartStable,
23+
Deno1193,
24+
Deno1303,
25+
DotNet60,
26+
DotNet80,
27+
FlutterStable,
28+
FlutterBeta,
29+
Go112,
30+
Go118,
31+
KotlinJava8,
32+
KotlinJava11,
33+
KotlinJava17,
34+
Node16,
35+
Node18,
36+
Node20,
37+
PHP74,
38+
PHP80,
39+
Python38,
40+
Python39,
41+
Python310,
42+
Ruby27,
43+
Ruby30,
44+
Ruby31,
45+
AppleSwift56,
46+
Swift56,
47+
WebChromium,
48+
WebNode
49+
]
1750

1851
steps:
1952
- name: Checkout repository

example.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function getSSLPage($url) {
186186
->setTwitter('appwrite_io')
187187
->setDiscord('564160730845151244', 'https://appwrite.io/discord')
188188
->setDefaultHeaders([
189-
'X-Appwrite-Response-Format' => '0.15.0',
189+
'X-Appwrite-Response-Format' => '1.5.0',
190190
])
191191
;
192192

@@ -393,7 +393,7 @@ function getSSLPage($url) {
393393
;
394394

395395
$sdk->generate(__DIR__ . '/examples/apple');
396-
396+
397397
// DotNet
398398
$sdk = new SDK(new DotNet(), new Swagger2($spec));
399399

@@ -442,7 +442,7 @@ function getSSLPage($url) {
442442
// Android
443443

444444
$sdk = new SDK(new Android(), new Swagger2($spec));
445-
445+
446446
$sdk
447447
->setName('Android')
448448
->setNamespace('io appwrite')
@@ -466,7 +466,7 @@ function getSSLPage($url) {
466466

467467
// Kotlin
468468
$sdk = new SDK(new Kotlin(), new Swagger2($spec));
469-
469+
470470
$sdk
471471
->setName('Kotlin')
472472
->setNamespace('io appwrite')

mock-server/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
mockapi:
53
container_name: mockapi

src/SDK/Language/Dart.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,13 @@ public function getFiles(): array
475475
],
476476
[
477477
'scope' => 'default',
478-
'destination' => '.travis.yml',
479-
'template' => 'dart/.travis.yml.twig',
478+
'destination' => '.github/workflows/publish.yml',
479+
'template' => 'dart/.github/workflows/publish.yml.twig',
480+
],
481+
[
482+
'scope' => 'default',
483+
'destination' => '.github/workflows/format.yml',
484+
'template' => 'dart/.github/workflows/format.yml.twig',
480485
],
481486
[
482487
'scope' => 'default',

src/SDK/Language/DotNet.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ public function getFiles(): array
303303
return [
304304
[
305305
'scope' => 'default',
306-
'destination' => '.travis.yml',
307-
'template' => 'dotnet/.travis.yml.twig',
306+
'destination' => '.github/workflows/publish.yml',
307+
'template' => 'dotnet/.github/workflows/publish.yml.twig',
308308
],
309309
[
310310
'scope' => 'default',
@@ -333,93 +333,93 @@ public function getFiles(): array
333333
],
334334
[
335335
'scope' => 'default',
336-
'destination' => '/src/{{ spec.title | caseUcfirst }}.sln',
337-
'template' => 'dotnet/src/Appwrite.sln',
336+
'destination' => '{{ spec.title | caseUcfirst }}.sln',
337+
'template' => 'dotnet/Package.sln',
338338
],
339339
[
340340
'scope' => 'default',
341-
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}.csproj',
342-
'template' => 'dotnet/src/Appwrite/Appwrite.csproj.twig',
341+
'destination' => '{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}.csproj',
342+
'template' => 'dotnet/Package/Package.csproj.twig',
343343
],
344344
[
345345
'scope' => 'default',
346-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Client.cs',
347-
'template' => 'dotnet/src/Appwrite/Client.cs.twig',
346+
'destination' => '{{ spec.title | caseUcfirst }}/Client.cs',
347+
'template' => 'dotnet/Package/Client.cs.twig',
348348
],
349349
[
350350
'scope' => 'default',
351-
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception.cs',
352-
'template' => 'dotnet/src/Appwrite/Exception.cs.twig',
351+
'destination' => '{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception.cs',
352+
'template' => 'dotnet/Package/Exception.cs.twig',
353353
],
354354
[
355355
'scope' => 'default',
356-
'destination' => '/src/{{ spec.title | caseUcfirst }}/ID.cs',
357-
'template' => 'dotnet/src/Appwrite/ID.cs.twig',
356+
'destination' => '{{ spec.title | caseUcfirst }}/ID.cs',
357+
'template' => 'dotnet/Package/ID.cs.twig',
358358
],
359359
[
360360
'scope' => 'default',
361-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Permission.cs',
362-
'template' => 'dotnet/src/Appwrite/Permission.cs.twig',
361+
'destination' => '{{ spec.title | caseUcfirst }}/Permission.cs',
362+
'template' => 'dotnet/Package/Permission.cs.twig',
363363
],
364364
[
365365
'scope' => 'default',
366-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Query.cs',
367-
'template' => 'dotnet/src/Appwrite/Query.cs.twig',
366+
'destination' => '{{ spec.title | caseUcfirst }}/Query.cs',
367+
'template' => 'dotnet/Package/Query.cs.twig',
368368
],
369369
[
370370
'scope' => 'default',
371-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Role.cs',
372-
'template' => 'dotnet/src/Appwrite/Role.cs.twig',
371+
'destination' => '{{ spec.title | caseUcfirst }}/Role.cs',
372+
'template' => 'dotnet/Package/Role.cs.twig',
373373
],
374374
[
375375
'scope' => 'default',
376-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Converters/ValueClassConverter.cs',
377-
'template' => 'dotnet/src/Appwrite/Converters/ValueClassConverter.cs.twig',
376+
'destination' => '{{ spec.title | caseUcfirst }}/Converters/ValueClassConverter.cs',
377+
'template' => 'dotnet/Package/Converters/ValueClassConverter.cs.twig',
378378
],
379379
[
380380
'scope' => 'default',
381-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs',
382-
'template' => 'dotnet/src/Appwrite/Extensions/Extensions.cs.twig',
381+
'destination' => '{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs',
382+
'template' => 'dotnet/Package/Extensions/Extensions.cs.twig',
383383
],
384384
[
385385
'scope' => 'default',
386-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/OrderType.cs',
387-
'template' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig',
386+
'destination' => '{{ spec.title | caseUcfirst }}/Models/OrderType.cs',
387+
'template' => 'dotnet/Package/Models/OrderType.cs.twig',
388388
],
389389
[
390390
'scope' => 'default',
391-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/UploadProgress.cs',
392-
'template' => 'dotnet/src/Appwrite/Models/UploadProgress.cs.twig',
391+
'destination' => '{{ spec.title | caseUcfirst }}/Models/UploadProgress.cs',
392+
'template' => 'dotnet/Package/Models/UploadProgress.cs.twig',
393393
],
394394
[
395395
'scope' => 'default',
396-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/InputFile.cs',
397-
'template' => 'dotnet/src/Appwrite/Models/InputFile.cs.twig',
396+
'destination' => '{{ spec.title | caseUcfirst }}/Models/InputFile.cs',
397+
'template' => 'dotnet/Package/Models/InputFile.cs.twig',
398398
],
399399
[
400400
'scope' => 'default',
401-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/Service.cs',
402-
'template' => 'dotnet/src/Appwrite/Services/Service.cs.twig',
401+
'destination' => '{{ spec.title | caseUcfirst }}/Services/Service.cs',
402+
'template' => 'dotnet/Package/Services/Service.cs.twig',
403403
],
404404
[
405405
'scope' => 'service',
406-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs',
407-
'template' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig',
406+
'destination' => '{{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs',
407+
'template' => 'dotnet/Package/Services/ServiceTemplate.cs.twig',
408408
],
409409
[
410410
'scope' => 'definition',
411-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs',
412-
'template' => 'dotnet/src/Appwrite/Models/Model.cs.twig',
411+
'destination' => '{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs',
412+
'template' => 'dotnet/Package/Models/Model.cs.twig',
413413
],
414414
[
415415
'scope' => 'enum',
416-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Enums/{{ enum.name | caseUcfirst | overrideIdentifier }}.cs',
417-
'template' => 'dotnet/src/Appwrite/Enums/Enum.cs.twig',
416+
'destination' => '{{ spec.title | caseUcfirst }}/Enums/{{ enum.name | caseUcfirst | overrideIdentifier }}.cs',
417+
'template' => 'dotnet/Package/Enums/Enum.cs.twig',
418418
],
419419
[
420420
'scope' => 'default',
421-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Enums/IEnum.cs',
422-
'template' => 'dotnet/src/Appwrite/Enums/IEnum.cs.twig',
421+
'destination' => '{{ spec.title | caseUcfirst }}/Enums/IEnum.cs',
422+
'template' => 'dotnet/Package/Enums/IEnum.cs.twig',
423423
]
424424
];
425425
}

src/SDK/Language/Flutter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,13 @@ public function getFiles(): array
332332
],
333333
[
334334
'scope' => 'default',
335-
'destination' => '.travis.yml',
336-
'template' => 'flutter/.travis.yml.twig',
335+
'destination' => '.github/workflows/publish.yml',
336+
'template' => 'flutter/.github/workflows/publish.yml.twig',
337+
],
338+
[
339+
'scope' => 'default',
340+
'destination' => '.github/workflows/format.yml',
341+
'template' => 'flutter/.github/workflows/format.yml.twig',
337342
],
338343
[
339344
'scope' => 'enum',

src/SDK/Language/Node.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public function getFiles(): array
234234
],
235235
[
236236
'scope' => 'default',
237-
'destination' => '.travis.yml',
238-
'template' => 'node/.travis.yml.twig',
237+
'destination' => '.github/workflows/publish.yml',
238+
'template' => 'node/.github/workflows/publish.yml.twig',
239239
],
240240
[
241241
'scope' => 'enum',

src/SDK/Language/Python.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public function getFiles(): array
202202
],
203203
[
204204
'scope' => 'default',
205-
'destination' => '.travis.yml',
206-
'template' => 'python/.travis.yml.twig',
205+
'destination' => '.github/workflows/publish.yml',
206+
'template' => 'python/.github/workflows/publish.yml.twig',
207207
],
208208
[
209209
'scope' => 'enum',

src/SDK/Language/Ruby.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ public function getFiles(): array
174174
],
175175
[
176176
'scope' => 'default',
177-
'destination' => '.travis.yml',
178-
'template' => 'ruby/.travis.yml.twig',
177+
'destination' => '.github/workflows/publish.yml',
178+
'template' => 'ruby/.github/workflows/publish.yml.twig',
179179
],
180180
[
181181
'scope' => 'definition',

0 commit comments

Comments
 (0)