dsaltares / fetch-gh-release-asset

Github Action to download an asset from a Github release
MIT License
113 stars 70 forks source link

Prefer node16 action to support macOS and Windows runners #36

Closed umireon closed 2 years ago

umireon commented 2 years ago

Implemented the same functionality as fetch_github_asset.sh in index.ts and made this action node16 action. By this change, macOS and Windows runners on GitHub Actions will be supported.

umireon commented 2 years ago

Linux runner: https://github.com/umireon/fetch-gh-release-asset-test/runs/5713847936?check_suite_focus=true macOS runner: https://github.com/umireon/fetch-gh-release-asset-test/runs/5713848011?check_suite_focus=true Windows runner: https://github.com/umireon/fetch-gh-release-asset-test/runs/5713847969?check_suite_focus=true

dsaltares commented 2 years ago

Thanks for your contribution, it's really significant.

I hadn't given any thought to supporting Windows and MacOS runners. That sounds great for sure!

However, it does have significant implications as it changes the language of this repo from bash scripting to Typescript. I'm actually more familiar with TS than bash but the change needs to be reviewed a bit more closely as it's, essentially, a full rewrite. It may have different implications for other contributors.

Please bear with me while I go through it. Given personal circumstances, it may take me over a week.

dsaltares commented 2 years ago

@umireon It does look like the integration test is failing, would you be able to look into it please? Thanks!

umireon commented 2 years ago

@dsaltares It seems that the GitHub authorization mechanism is broken now. Please re-run the test later.

umireon commented 2 years ago

The existing Docker action is also broken now. The problem should be in the GitHub infrastructure. https://github.com/umireon/fetch-gh-release-asset-test/runs/5737474231?check_suite_focus=true

dsaltares commented 2 years ago

@umireon GH's status page is green https://www.githubstatus.com and the error is related to API rate limiting.

image
umireon commented 2 years ago

@dsaltares It hits the API limit due to the requests are not authorized against the GitHub API despite the correct Authorization header being present. I'm pretty sure this is a GitHub outage because this code worked yesterday without errors many times. I will ask for GitHub support for this phenomenon.

umireon commented 2 years ago

@dsaltares I've created a support ticket to GitHub. Please wait for the response from GitHub support.

umireon commented 2 years ago

Still no response from GitHub. I had created the ticket from the paid organization so the response would be soon.

umireon commented 2 years ago

@dsaltares I talked with GitHub Support and managed to fix the problems. Please re-run the integration tests.

dsaltares commented 2 years ago

Great stuff, thanks @umireon!

guilhermeblanco commented 2 years ago

This PR merge broke our pipeline. It seems that since we now assume a well-formed version as part of the getRelease function, it completely ignored the scenario where you may be downloading draft assets (which means release version is "untagged-XXX", for example: untagged-f8c3edf8af6344f60679).

What we experience now is a "Malformed version" error when attempting to download assets, as shown in the picture below. Screenshot from 2022-04-19 10-31-15

Here is a sample that reflects how we do with drafts:

name: build-artifact

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Draft new release
        id: draft_release
        uses: release-drafter/release-drafter@v5
        with:
          config-name: release-drafter.yml
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Upload assets
        id: upload_assets
        run: |
          gh release upload --clobber ${{ env.VERSION }} ${{ env.FILES }}
        env:
          GITHUB_TOKEN: ${{ secrets.GIT_PERSONAL_TOKEN }}
          VERSION: ${{ steps.draft_release.outputs.tag_name }}
          FILES: |
            release_asset.jar

    outputs:
      release_id: ${{ steps.draft_release.outputs.id }}
      release_name: ${{ steps.draft_release.outputs.name }}
      release_tag: ${{ steps.draft_release.outputs.tag_name }}
      release_url: ${{ steps.draft_release.outputs.html_url }}
      release_body: ${{ steps.draft_release.outputs.body }}
      release_upload_url: ${{ steps.draft_release.outputs.upload_url }}

  reelase:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Download release asset
        id: download_asset
        uses: dsaltares/fetch-gh-release-asset@master
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          version: ${{ needs.build.outputs.release_id }}
          file: release_asset.jar
          target: release_asset.jar
dsaltares commented 2 years ago

@guilhermeblanco apologies, can you open an issue for this? In the meantime, can you pin your pipeline to the latest release instead of master? That will unblock you.

guilhermeblanco commented 2 years ago

@guilhermeblanco apologies, can you open an issue for this? In the meantime, can you pin your pipeline to the latest release instead of master? That will unblock you.

Done. https://github.com/dsaltares/fetch-gh-release-asset/issues/38

umireon commented 2 years ago

40 will fix #38 sorry for inconvinience