From e10b7757fd737efd9b2d242a8d2817c0dc575c7b Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Wed, 17 Jan 2024 17:21:28 +0800 Subject: [PATCH] feat: polish the release GitHub action (#395) --- .github/workflows/push_to_new_AppStore.yml | 41 ---------------------- .github/workflows/release.yml | 6 ++++ .github/workflows/release_zip.yml | 34 ++++++++++++++---- 3 files changed, 34 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/push_to_new_AppStore.yml diff --git a/.github/workflows/push_to_new_AppStore.yml b/.github/workflows/push_to_new_AppStore.yml deleted file mode 100644 index 0bcd13fba..000000000 --- a/.github/workflows/push_to_new_AppStore.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: build documentation and publish - -on: - push: - branches: - - main -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: remove all file except icon.png - run: find . -type f -not \( -name '*.yml' \) -delete - - name: Pushes to another repository - uses: cpina/github-action-push-to-another-repository@main - env: - API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB2 }} - with: - source-directory: './Apps' - destination-github-username: 'IceWhaleTech' - destination-repository-name: '_appstore' - user-email: q2676515970@163.com - target-directory: './Apps' - - name: Copycat - uses: andstor/copycat-action@v3 - with: - personal_token: ${{ secrets.API_TOKEN_GITHUB2 }} - src_path: ./recommend-list.json - dst_owner: IceWhaleTech - dst_repo_name: _appstore - email: q2676515970@163.com - src_branch: main - dst_branch: main - - name: Error Handling - if: ${{ failure() }} - run: | - curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"CasaOS-AppStore build and publish error"}}' ${{ secrets.APPSTORE_ROBOT_URL }} - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccde08c1c..3dcfde4c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,11 @@ jobs: run: find . -name "screenshot*" | xargs rm -f - name: remove all thumbnails run: find . -name "thumbnail*" | xargs rm -f + - name: remove all icon + run: find . -name "icon.png" | xargs rm -f + - name: remove all app file + run: find . -name "appfile.json" | xargs rm -f + - name: create a build with sysroot id: build run: | @@ -38,6 +43,7 @@ jobs: - name: Get version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - name: Upload to oss id: upload_to_oss uses: tvrcgo/upload-to-oss@master diff --git a/.github/workflows/release_zip.yml b/.github/workflows/release_zip.yml index 7de896a16..48fbd536a 100644 --- a/.github/workflows/release_zip.yml +++ b/.github/workflows/release_zip.yml @@ -14,6 +14,11 @@ jobs: run: find . -name "screenshot*" | xargs rm -f - name: remove all thumbnails run: find . -name "thumbnail*" | xargs rm -f + - name: remove all icon + run: find . -name "icon.png" | xargs rm -f + - name: remove all app file + run: find . -name "appfile.json" | xargs rm -f + - name: create a build with sysroot id: build run: | @@ -27,10 +32,15 @@ jobs: pushd /tmp zip -r main.zip build - - name: Copy + - name: Checkout pages + uses: actions/checkout@v4 + with: + ref: gh-pages + path: pages + + - name: Copy build to pages run: | - mkdir pages - cp /tmp/main.zip pages/main.zip + cp /tmp/main.zip pages/store/main.zip - name: Pushes to another repository uses: cpina/github-action-push-to-another-repository@main @@ -38,7 +48,19 @@ jobs: API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB2 }} with: source-directory: 'pages' - destination-github-username: 'CasaOS-AppStore' - destination-repository-name: 'casaos-appstore.github.io' + destination-github-username: 'IceWhaleTech' + destination-repository-name: 'CasaOS-AppStore' + target-branch: 'gh-pages' user-email: wiki@casaos.io - target-directory: 'heads' \ No newline at end of file + target-directory: '' + + - name: Upload to oss + id: upload_to_oss + uses: tvrcgo/upload-to-oss@master + with: + key-id: ${{ secrets.OSS_KEY_ID }} + key-secret: ${{ secrets.OSS_KEY_SECRET }} + region: oss-cn-shanghai + bucket: casaos + assets: | + /tmp/main.zip:/store/main.zip \ No newline at end of file