From fbcddd0350997720b00d9282acf0028ee65d050c Mon Sep 17 00:00:00 2001 From: acocalypso Date: Mon, 8 Apr 2024 17:05:05 +0200 Subject: [PATCH] push json after all packages are compiled --- .github/workflows/build.yml | 63 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c70d39e..26b724e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,44 +79,29 @@ jobs: skipIfReleaseExists: true tag: v${{ steps.get_version.outputs.version }} - - name: Create updater.json - if: matrix.platform == 'ubuntu-20.04' + update-gist: + runs-on: ubuntu-latest + needs: [publish-tauri-macos-latest, publish-tauri-ubuntu-20.04, publish-tauri-windows-latest] + steps: + - name: Get latest release + id: get_latest_release + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + const response = await github.repos.getLatestRelease({ owner, repo }); + return response.data; + + - name: Get latest release content + id: get_latest_release_content run: | - current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - app_name="stellarium-goto" - tag="app-v${{ steps.get_version.outputs.version }}" - - echo '{ - "version": "${{ steps.get_version.outputs.version }}", - "notes": "See release notes for details.", - "pub_date": "'"$current_date"'", - "platforms": { - "linux-x86_64": { - "signature": "'"$content_of_linux_signature"'", - "url": "https://github.com/${{ github.repository }}/releases/download/'"$tag"'/'"$app_name"'_${{ steps.get_version.outputs.version }}_amd64.AppImage" - }, - "darwin-x86_64": { - "signature": "'"$content_of_darwin_signature"'", - "url": "https://github.com/${{ github.repository }}/releases/download/'"$tag"'/'"$app_name"'_${{ steps.get_version.outputs.version }}_x64.app.tar.gz" - }, - "windows-x86_64": { - "signature": "'"$content_of_windows_signature"'", - "url": "https://github.com/${{ github.repository }}/releases/download/'"$tag"'/'"$app_name"'_${{ steps.get_version.outputs.version }}_x64-setup.exe" - }, - "macos-x86_64": { - "signature": "'"$content_of_windows_signature"'", - "url": "https://github.com/${{ github.repository }}/releases/download/'"$tag"'/'"$app_name"'_${{ steps.get_version.outputs.version }}_x64.dmg" - }, - } - }' > update.json + latest_release_assets=$(curl -s "${{ steps.get_latest_release.outputs.url }}/assets") + latest_release_json=$(echo "$latest_release_assets" | jq '[.[] | {name: .name, download_url: .browser_download_url}]') + echo "::set-output name=latest_release_json::$latest_release_json" - - name: Update Gist - if: matrix.platform == 'ubuntu-20.04' - uses: exuanbo/actions-deploy-gist@v1 - with: - token: ${{ secrets.TOKEN }} - gist_id: ${{ secrets.GIST_ID }} - file_path: update.json - file_type: text - gist_description: "Updater JSON for the latest release" - gist_file_name: "update.json" \ No newline at end of file + - name: Create updater.json + run: | + current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + latest_release_json=${{ steps.get_latest_release_content.outputs.latest_release_json }} + echo "$latest_release_json" > update.json \ No newline at end of file