[build] Push extracted API specs to git repo (#4521)
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 29 Aug 2022 05:28:20 +0000 (14:28 +0900)
committerWonyoung Choi <wy80.choi@samsung.com>
Mon, 29 Aug 2022 07:49:25 +0000 (16:49 +0900)
Push the extracted API spec files to TizenAPI/tizenfx-api-specs repo instead of S3.

.github/workflows/build-branches.yml

index a38a32d..e277c3e 100644 (file)
@@ -12,6 +12,7 @@ on:
     - 'internals/**'
     - 'src/**'
     - 'tools/**'
+    - '.github/workflows/**'
 
 jobs:
   build:
@@ -39,13 +40,21 @@ jobs:
             -- print --format=json --include-hidden \
             -o Artifacts/api.json Artifacts/bin/public/
 
-    - name: Upload API Spec to S3
-      uses: TizenAPI/tizenfx-build-actions/s3-upload@master
-      env:
-        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
-        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+    - name: Checkout APISpec
+      uses: actions/checkout@v3
       with:
-        file: Artifacts/api.json
-        region: ap-northeast-2
-        bucket: tizenfx-api-specs
-        key: ${{ github.sha }}.json
+        repository: TizenAPI/tizenfx-api-specs
+        token: ${{ secrets.TIZENAPI_GITHUB_TOKEN }}
+        path: .apispec
+    
+    - name: Push to APISpec
+      working-directory: .apispec
+      run: |
+        git config --global user.name "TizenAPI-Bot"
+        git config --global user.email "tizenapi@samsung.net"
+        git checkout --orphan prep
+        gzip -c ../Artifacts/api.json > ${{ github.sha }}.json.gz
+        find . -name "*.json.gz" -type f -mtime +30 -delete
+        git add .
+        git commit -m "Update API spec"
+        git push -f origin HEAD:main