From a5c77b81c26adc6905c54778e0b25a576f17c1bc Mon Sep 17 00:00:00 2001 From: acocalypso Date: Mon, 8 Apr 2024 23:39:23 +0200 Subject: [PATCH] test --- .github/workflows/build.yml | 21 +++++++++++++++++++- .github/workflows/gist-test.yml | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/gist-test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7fc1d2d..a9f2c30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,6 +95,7 @@ jobs: update-gist: runs-on: ubuntu-latest + needs: [publish-tauri] steps: - name: Get latest release id: get_latest_release @@ -114,7 +115,25 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${latest_release_tag}/latest.json" \ -o latest.json - + - name: Download latest.json + run: | + latest_release_tag=${{ steps.get_latest_release.outputs.result }} + curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.RELEASE_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" \ + -o latest.json + + - name: Update Gist + uses: exuanbo/actions-deploy-gist@v1 + with: + token: ${{ secrets.TOKEN }} + gist_id: ${{ secrets.GIST_ID }} + file_path: latest.json + file_type: text + gist_description: "Updater JSON for the latest release" + gist_file_name: "latest.json" - name: Update Gist uses: exuanbo/actions-deploy-gist@v1 with: diff --git a/.github/workflows/gist-test.yml b/.github/workflows/gist-test.yml new file mode 100644 index 0000000..d3990b9 --- /dev/null +++ b/.github/workflows/gist-test.yml @@ -0,0 +1,34 @@ +name: 'gist-test' + +on: + workflow_dispatch: + +jobs: + update-gist: + runs-on: ubuntu-latest + steps: + - name: Get latest release + id: get_latest_release + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const response = await github.repos.getLatestRelease(context.repo); + return response.data.tag_name; + + - name: Download latest.json + run: | + latest_release_tag=${{ steps.get_latest_release.outputs.result }} + release_info=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.RELEASE_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${latest_release_tag}") + latest_json_url=$(echo "$release_info" | jq -r .tarball_url) # or use .zipball_url + curl -L "$latest_json_url" -o latest.json + + - name: Update Gist + uses: exuanbo/actions-deploy-gist@v1 + with: + token: ${{ secrets.TOKEN }} + gist_id: ${{ secrets.GIST_ID }} + file_path: latest.json + file_type: text + gist_description: "Updater JSON for the latest release" + gist_file_name: "latest.json" \ No newline at end of file