Giter VIP home page Giter VIP logo

uploadtool's Introduction

uploadtool

Super simple uploading of continuous builds (each push) to GitHub Releases. If this is not the easiest way to upload continuous builds to GitHub Releases, then it is a bug.

Usage

This script is designed to be called from Travis CI after a successful build. By default, this script will delete any pre-existing release tagged with continuous, tag the current state with the name continuous, create a new release with that name, and upload the specified binaries there. For pull requests, it will upload the binaries to transfersh.com instead and post the resulting download URL to the pull request page on GitHub.

  • On https://github.com/settings/tokens, click on "Generate new token" and generate a token with at least the public_repo, repo:status, and repo_deployment scopes
  • On Travis CI, go to the settings of your project at https://travis-ci.com/yourusername/yourrepository/settings
  • Under "Environment Variables", add key GITHUB_TOKEN and the token you generated above as the value. Make sure that "Display value in build log" is set to "OFF"! Also make sure it is only available to your main branch (most of the time, master) to avoid leaking it and prevent uploads for any other branches!
  • In the .travis.yml of your GitHub repository, add something like this (assuming the build artifacts to be uploaded are in out/):
after_success:
  - ls -lh out/* # Assuming you have some files in out/ that you would like to upload
  - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
  - bash upload.sh out/*

branches:
  except:
    - # Do not build tags that we create when we upload to GitHub Releases
    - /^(?i:continuous.*)$/

It is also possible to use this script with GitHub actions. The GITHUB_TOKEN is already available in the main branch but it needs to be passes as an environment variable to the script:

- name: Upload files
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    set -e
    ls -lh out/* # Assuming you have some files in out/ that you would like to upload
    wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
    bash upload.sh out/*

Environment variables

upload.sh normally only creates one stream of continuous releases for the latest commits that are pushed into (or merged into) the repository.

It's possible to use upload.sh in a more complex manner by setting the environment variable UPLOADTOOL_SUFFIX. If this variable is set to the name of the current tag, then upload.sh will upload a release to the repository (basically reproducing the deploy: feature in .travis.yml).

If UPLOADTOOL_SUFFIX is set to a different text, then this text is used as suffix for the continuous tag that is created for continuous releases. This way, a project can customize what releases are being created. One possible use case for this is to set up continuous builds for feature or test branches:

  if [ ! -z $TRAVIS_BRANCH ] && [ "$TRAVIS_BRANCH" != "master" ] ; then
    export UPLOADTOOL_SUFFIX=$TRAVIS_BRANCH
  fi

This will create builds tagged with continuous for pushes / merges to master and with continuous-<branch-name> for pushes / merges to other branches.

The two environment variables UPLOADTOOL_PR_BODY and UPLOADTOOL_BODY allow the calling script to customize the messages that are posted either for pull requests or merges / pushes. If these variables aren't set, generic default texts are used.

Set the environment variable UPLOADTOOL_ISPRERELEASE=true if you want an untagged release to be marked as pre-release on GitHub.

Note that UPLOADTOOL* variables will be used in bash script to form a JSON request, that means some characters like double quotes and new lines need to be escaped - example: export UPLOADTOOL_BODY="\\\"Experimental\\\" version.\nDon't use this.\nTravis CI build log: https://travis-ci.com/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID/"

uploadtool's People

Contributors

a1batross avatar aferrero2707 avatar calinou avatar coslyk avatar damirporobic avatar dirkhh avatar dlemstra avatar itsmattkc avatar jviotti avatar mortbopet avatar probonopd avatar theassassin avatar thelastproject avatar tsteven4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uploadtool's Issues

upload tool for appveyor

I like the upload tool for travis. For appveyor I created upload_appveyor.sh, substituting in APPVEYOR variables for the TRAVIS ones. I had issues with the appveyor GitHub deployment provider keeping multiple versions of continuous release. I ended up using the tag "continous" for travis and "continuous-windows" for appveyor to keep them from stepping on each other. Of course you need bash to run it, but this is commonly done with msys64 in appveyor.yml e.g.

C:\msys64\usr\bin\bash.exe -lc "cd $env:projdir; ./tools/uploadtool/upload_appveyor.sh GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Setup.exe"

If this is of interest please let me know. It would be possible to have one script, i.e. upload.sh, work with both travis and appveyor but that would be a bit more work.

uploading large file fails

Upload binaries to the release...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 2392M  100   246    0     0    647      0 --:--:-- --:--:-- --:--:--   645
{"message":"Validation Failed","request_id":"xxx:xxx:xxxx:xxxxx:xxxxxxxx","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"custom","field":"size","message":"size is not included in the list"}]}

Does it need some more permissions for token?
currently have only checked repo section only.

Race condition deleting build

I use uploadtool.sh for both macOS .dmg and Linux AppImage on https://github.com/Pext/Pext/releases. Someone, a race condition make the macOS build delete the AppImage build.

At the time this happened, Pext/Pext@5458d76 was the most recent continous commit. Which is build 370 on Travis: https://travis-ci.org/Pext/Pext/builds/362457504.

I won't wait forever with pushing more commits, which will surely fix it again, but hopefully the logs can help you figure out how the race condition happened.

Fails silently if transfer.sh has issues

Release uploading disabled for pull requests
Release uploading disabled for pull requests, uploading to transfer.sh instead
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 84.7M    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0 84.7M    0     0    0  432k      0   216k  0:06:41  0:00:02  0:06:39  158k
  0 84.7M    0     0    0  432k      0   144k  0:10:02  0:00:03  0:09:59  115k
  0 84.7M    0     0    0  432k      0   108k  0:13:23  0:00:04  0:13:19 93405
  0 84.7M  100    24    0  432k      4  88473  0:16:44  0:00:05  0:16:39 90118
  0 84.7M  100    24    0  432k      4  88473  0:16:44  0:00:05  0:16:39  110k
Could not save metadata
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  296k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  296k    0     0  100  296k      0   148k  0:00:02  0:00:02 --:--:--  108k
100  296k    0     0  100  296k      0    98k  0:00:03  0:00:03 --:--:-- 81593
100  296k    0     0  100  296k      0  76024  0:00:04  0:00:04 --:--:-- 64318
100  296k  100    24  100  296k      4  60819  0:00:06  0:00:05  0:00:01 57555
100  296k  100    24  100  296k      4  60819  0:00:06  0:00:05  0:00:01 77820
Could not save metadata
[...]
Done. Your build exited with 0.

It should probably detect this and error out or preferably fall back on another service.

Odd text on release page

I'm not sure if this is my mistake or if this is an issue with uploadtool...
A successful continuous build release gets this text for me:

Release%20generated%20by%20Travis%20CI%20build%20no.%201191.%0a%0aBuild%20log%3a%20https%3a%2f%2ftravis-ci.org%2fSubsurface-divelog%2fsubsurface%2fbuilds%2f297803667%2f%0a%0a_Generated%20by%20%5buploadtool%5d%28https%3a%2f%2fgithub.com%2fprobonopd%2fuploadtool%29._

This clearly is HTML encoded text. Any idea what's going on here?

https://github.com/Subsurface-divelog/subsurface/releases/tag/continuous

Overwrite same commit

How do you overwrite the same commit?

Can I comment out line #271
if [ "$TRAVIS_COMMIT" != "$tag_sha" ] ; then

I want it overwrite the same commit if the build is successful.

issues with release deletion and travis build re-triggering

I have started testing the upload tool on my project, and it is really awesome! However, I have a couple of problems:

Any idea of what I could be doing wrong?

My Travis configuration is associated with the "stable" branch (the one in the master branch is not updated...)

Thanks!

Move away from personal access tokens

Personal access tokens cannot be limited to single projects. This is really insecure. A working workaround is to create bot users per project (this is generally a good idea). PR is on the way to clarify that.

Someone should however investigate whether it's possible to use alternative authentication methods of the GitHub API, e.g., something OAuth2 based. Those tokens can be limited to projects/organizations.

Don't upload releases unless on primary branch

Note: the term master branch is avoided on purpose. Many projects use another branch as primary branch, e.g., AppImageKit uses appimagetool/master, AppImageUpdate uses rewrite at the moment.

In many projects, there's development ongoing in branches outside the primary branch. Not everyone is happy with n forks for n developers, and for e.g., your own projects, GitHub creates branches in the same repository during many operations like file editing.

In such scenarios, uploadtool should not upload binaries to GitHub releases when Travis builds those branches. Instead, it should follow the PR strategy, and upload the binaries to https://transfer.sh (or some other location, see #28).

My current workaround in many projects is a line in the .travis.yml:

https://github.com/AppImage/AppImageUpdate/blob/65b152ef3c5737aa7bea24ccd350556482a5656d/.travis.yml#L17

Cannot figure out the release URL for continuous

For last two days I have folowing error message on TravisCl when used https://github.com/probonopd/uploadtool/raw/master/upload.sh to upload package to GitHub releases.

Cannot figure out the release URL for continuous

I have no clue what could be wrong. Has any of you similar problem or know the solution?
I used it for last year without any issues and I didn't make any changes in configuration of TravisCl or GitHub.

Full log from GitHub is following:

Please consider submitting your AppImage to AppImageHub, the crowd-sourced
central directory of available AppImages, by opening a pull request
at https://github.com/AppImage/appimage.github.io
Desktop file: /home/travis/build/buddhi1980/mandelbulber2/mandelbulber2/build/appdir/mandelbulber2.desktop
/home/travis/build/buddhi1980/mandelbulber2/mandelbulber2/build/appdir should be packaged as Mandelbulber_v2-16cc8ce-x86_64.AppImage
Size of the embedded runtime: 188456 bytes
Guessing update information based on $TRAVIS_TAG= and $TRAVIS_REPO_SLUG=buddhi1980/mandelbulber2
gh-releases-zsync|buddhi1980|mandelbulber2|continuous|Mandelbulber_v2*-x86_64.AppImage.zsync
updateinformation type: gh-releases-zsync
ui_offset: 175784
ui_length: 1024
--2020-09-12 16:34:28--  https://github.com/probonopd/uploadtool/raw/master/upload.sh
Resolving github.com (github.com)... 140.82.112.3
Connecting to github.com (github.com)|140.82.112.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh [following]
--2020-09-12 16:34:28--  https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9755 (9.5K) [text/plain]
Saving to: ‘upload.sh’
     0K .........                                             100% 73.3M=0s
2020-09-12 16:34:28 (73.3 MB/s) - ‘upload.sh’ saved [9755/9755]
Running on Travis CI
TRAVIS_COMMIT: 16cc8ce83751ca8e08ca4a9c1617696fa308ea44
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   135  100   135    0     0    727      0 --:--:-- --:--:-- --:--:--   729
tag_infos: {
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/enterprise/2.18/user/rest/reference/git#get-a-reference"
}
tag_sha: 
Getting the release ID...
release_url: https://api.github.com/repos/buddhi1980/mandelbulber2/releases/tags/continuous
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126  100   126    0     0    807      0 --:--:-- --:--:-- --:--:--   812
release_infos: {
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-release-by-tag-name"
}
release ID: 
upload_url: 
release_url: 
target_commit_sha: 
TRAVIS_COMMIT != target_commit_sha, hence deleting continuous...
Delete the tag...
delete_url: https://api.github.com/repos/buddhi1980/mandelbulber2/git/refs/tags/continuous
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   132  100   132    0     0    811      0 --:--:-- --:--:-- --:--:--   814
{
  "message": "Reference does not exist",
  "documentation_url": "https://docs.github.com/rest/reference/git#delete-a-reference"
}
Create release...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   370  100   129  100   241    813   1520 --:--:-- --:--:-- --:--:--  1525
{
  "message": "Problems parsing JSON",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-release"
}
upload_url: 
release_url: 
Cannot figure out the release URL for continuous

Build latest tag only

I would like to have the build files on a separate branch and whenever that branch is updated they should checkout the latest release tag, build and upload the files to the existing tag.

That way I could do the following: import the latest commits from another project to my fork on Github and when a new release tag exists I will trigger my "travis" branch and the latest release version will be built and uploaded to Github without deleting uploads to older release tags.

Is that possible?

Upload to transfer.sh if GITHUB_TOKEN is missing

It would be super useful if uploadtool would just always upload the results somewhere, even if an upload to GitHub releases is not possible. I know that this behavior is partly intentional to make people add the token environment variable, but I think not uploading at all isn't ideal either.

One could show a big, fat, red warning that the token is missing, but I'd upload to transfer.sh in that case, otherwise it gets difficult to test the build results. Also, forks which implement a feature might not want to upload to GitHub releases either, or create PR in the upstream project just yet, e.g., to prevent premature merging. Hence, it makes sense to upload to transfer.sh in those cases, allowing everyone to test the artifacts and verify them.

The current workaround for this limitation is to "emulate" a PR by calling export TRAVIS_EVENT_TYPE=pull_request, which obviously has to be removed in a PR afterwards, leaving a chance of being merged by the upstream project, which is more problematic than implementing the behavior proposed in this issue.

Release notification being generated for every rebuild

We've discovered an unfortunate side effect of the current upload script. 😉

Every time it runs, everyone watching our project is getting spammed by a new "release notification".
eg for every single commit we do

It's becoming pretty annoying. 😦

Looking through the upload script (and now afterwards, reading the readme) it's recreating the release every time.

That might be workable for low churn projects... but it's not really a go-er for us.

Any thoughts on how to avoid this problem, apart from just stopping these Continuous builds?

Release name not set on macOS

The bash(?) version that comes on macOS/Travis CI is too old to recognise the substitution on line 45.
image
This results in the upload tool not setting the release name correctly.

Upload fails for multiple files with similar name which does not match case.

 $ bash upload.sh AppImageUpdater*.AppImage* appimageupdater*.AppImage

The above command only uploads AppImageUpdater*.AppImage*. (i.e) Only the first two files is uploaded. If I place appimageupdater*.AppImage first then only that gets uploaded.

From the travis log, this message seems to be related to this issue.

{"message":"Validation Failed","request_id":"BACE:288E:2F74:3C15:5DDCA797","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"already_exists","field":"name"}]}

But this seems to work in AppImageUpdate repo, it's strange. But AppImageUpdate did not make any updates recently so that might explain something was done recently to cause this?

Here is the travis log,

Running on Travis CI
TRAVIS_COMMIT: 7834f4747db5146266e1ee40101a1809e3d6bca0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   398  100   398    0     0   1933      0 --:--:-- --:--:-- --:--:--  1941
tag_infos: {
  "ref": "refs/tags/continuous",
  "node_id": "MDM6UmVmMTE2NTUxMDk5OmNvbnRpbnVvdXM=",
  "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/git/refs/tags/continuous",
  "object": {
    "sha": "5a3086e7996c64fd35cf7b1ed3bbf3666e3b3495",
    "type": "commit",
    "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/git/commits/5a3086e7996c64fd35cf7b1ed3bbf3666e3b3495"
  }
}
tag_sha: 5a3086e7996c64fd35cf7b1ed3bbf3666e3b3495
Getting the release ID...
release_url: https://api.github.com/repos/antony-jr/AppImageUpdater/releases/tags/continuous
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  5550  100  5550    0     0  33454      0 --:--:-- --:--:-- --:--:-- 33636
release_infos: {
  "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21753776",
  "assets_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21753776/assets",
  "upload_url": "https://uploads.github.com/repos/antony-jr/AppImageUpdater/releases/21753776/assets{?name,label}",
  "html_url": "https://github.com/antony-jr/AppImageUpdater/releases/tag/continuous",
  "id": 21753776,
  "node_id": "MDc6UmVsZWFzZTIxNzUzNzc2",
  "tag_name": "continuous",
  "target_commitish": "5a3086e7996c64fd35cf7b1ed3bbf3666e3b3495",
  "name": "Continuous build",
  "draft": false,
  "author": {
    "login": "antony-jr",
    "id": 33930174,
    "node_id": "MDQ6VXNlcjMzOTMwMTc0",
    "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/antony-jr",
    "html_url": "https://github.com/antony-jr",
    "followers_url": "https://api.github.com/users/antony-jr/followers",
    "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
    "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
    "organizations_url": "https://api.github.com/users/antony-jr/orgs",
    "repos_url": "https://api.github.com/users/antony-jr/repos",
    "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
    "received_events_url": "https://api.github.com/users/antony-jr/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": true,
  "created_at": "2019-11-26T03:15:48Z",
  "published_at": "2019-11-26T03:39:15Z",
  "assets": [
    {
      "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16398761",
      "id": 16398761,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDE2Mzk4NzYx",
      "name": "AppImageUpdater-5a3086e-x86_64.AppImage",
      "label": "",
      "uploader": {
        "login": "antony-jr",
        "id": 33930174,
        "node_id": "MDQ6VXNlcjMzOTMwMTc0",
        "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/antony-jr",
        "html_url": "https://github.com/antony-jr",
        "followers_url": "https://api.github.com/users/antony-jr/followers",
        "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
        "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
        "organizations_url": "https://api.github.com/users/antony-jr/orgs",
        "repos_url": "https://api.github.com/users/antony-jr/repos",
        "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
        "received_events_url": "https://api.github.com/users/antony-jr/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/octet-stream",
      "state": "uploaded",
      "size": 8384552,
      "download_count": 1,
      "created_at": "2019-11-26T03:39:15Z",
      "updated_at": "2019-11-26T03:39:16Z",
      "browser_download_url": "https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/AppImageUpdater-5a3086e-x86_64.AppImage"
    },
    {
      "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16398762",
      "id": 16398762,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDE2Mzk4NzYy",
      "name": "AppImageUpdater-5a3086e-x86_64.AppImage.zsync",
      "label": "",
      "uploader": {
        "login": "antony-jr",
        "id": 33930174,
        "node_id": "MDQ6VXNlcjMzOTMwMTc0",
        "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/antony-jr",
        "html_url": "https://github.com/antony-jr",
        "followers_url": "https://api.github.com/users/antony-jr/followers",
        "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
        "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
        "organizations_url": "https://api.github.com/users/antony-jr/orgs",
        "repos_url": "https://api.github.com/users/antony-jr/repos",
        "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
        "received_events_url": "https://api.github.com/users/antony-jr/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/octet-stream",
      "state": "uploaded",
      "size": 24818,
      "download_count": 1,
      "created_at": "2019-11-26T03:39:16Z",
      "updated_at": "2019-11-26T03:39:16Z",
      "browser_download_url": "https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/AppImageUpdater-5a3086e-x86_64.AppImage.zsync"
    }
  ],
  "tarball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/tarball/continuous",
  "zipball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/zipball/continuous",
  "body": "Travis CI build log: https://travis-ci.org/antony-jr/AppImageUpdater/builds/617014696"
}
release ID: 21753776
upload_url: https://uploads.github.com/repos/antony-jr/AppImageUpdater/releases/21753776/assets
release_url: https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21753776
target_commit_sha: 5a3086e7996c64fd35cf7b1ed3bbf3666e3b3495
TRAVIS_COMMIT != target_commit_sha, hence deleting continuous...
Delete the release...
delete_url: https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21753776
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Delete the tag...
delete_url: https://api.github.com/repos/antony-jr/AppImageUpdater/git/refs/tags/continuous
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Create release...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   246    0     0  100   246      0    204  0:00:01  0:00:01 --:--:--   204
100  2292  100  2046  100   246   1670    200  0:00:01  0:00:01 --:--:--  1671
{
  "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21754256",
  "assets_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21754256/assets",
  "upload_url": "https://uploads.github.com/repos/antony-jr/AppImageUpdater/releases/21754256/assets{?name,label}",
  "html_url": "https://github.com/antony-jr/AppImageUpdater/releases/tag/continuous",
  "id": 21754256,
  "node_id": "MDc6UmVsZWFzZTIxNzU0MjU2",
  "tag_name": "continuous",
  "target_commitish": "7834f4747db5146266e1ee40101a1809e3d6bca0",
  "name": "Continuous build",
  "draft": false,
  "author": {
    "login": "antony-jr",
    "id": 33930174,
    "node_id": "MDQ6VXNlcjMzOTMwMTc0",
    "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/antony-jr",
    "html_url": "https://github.com/antony-jr",
    "followers_url": "https://api.github.com/users/antony-jr/followers",
    "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
    "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
    "organizations_url": "https://api.github.com/users/antony-jr/orgs",
    "repos_url": "https://api.github.com/users/antony-jr/repos",
    "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
    "received_events_url": "https://api.github.com/users/antony-jr/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": true,
  "created_at": "2019-11-26T03:52:29Z",
  "published_at": "2019-11-26T04:18:29Z",
  "assets": [

  ],
  "tarball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/tarball/continuous",
  "zipball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/zipball/continuous",
  "body": "Travis CI build log: https://travis-ci.org/antony-jr/AppImageUpdater/builds/617022116"
}
upload_url: https://uploads.github.com/repos/antony-jr/AppImageUpdater/releases/21754256/assets
release_url: https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21754256
Upload binaries to the release...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 6188k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 6189k    0  1446  100 6188k   1627  6966k --:--:-- --:--:-- --:--:-- 6960k
{"url":"https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16399060","id":16399060,"node_id":"MDEyOlJlbGVhc2VBc3NldDE2Mzk5MDYw","name":"appimageupdater-7834f47-x86_64.AppImage","label":"","uploader":{"login":"antony-jr","id":33930174,"node_id":"MDQ6VXNlcjMzOTMwMTc0","avatar_url":"https://avatars2.githubusercontent.com/u/33930174?v=4","gravatar_id":"","url":"https://api.github.com/users/antony-jr","html_url":"https://github.com/antony-jr","followers_url":"https://api.github.com/users/antony-jr/followers","following_url":"https://api.github.com/users/antony-jr/following{/other_user}","gists_url":"https://api.github.com/users/antony-jr/gists{/gist_id}","starred_url":"https://api.github.com/users/antony-jr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antony-jr/subscriptions","organizations_url":"https://api.github.com/users/antony-jr/orgs","repos_url":"https://api.github.com/users/antony-jr/repos","events_url":"https://api.github.com/users/antony-jr/events{/privacy}","received_events_url":"https://api.github.com/users/antony-jr/received_events","type":"User","site_admin":false},"content_type":"application/octet-stream","state":"uploaded","size":6336552,"download_count":0,"created_at":"2019-11-26T04:18:29Z","updated_at":"2019-11-26T04:18:30Z","browser_download_url":"https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/appimageupdater-7834f47-x86_64.AppImage"}
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 19542    0   724  100 18818   1202  31253 --:--:-- --:--:-- --:--:-- 31259
100 20274    0  1456  100 18818   2417  31249 --:--:-- --:--:-- --:--:-- 31207
{"url":"https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16399061","id":16399061,"node_id":"MDEyOlJlbGVhc2VBc3NldDE2Mzk5MDYx","name":"appimageupdater-7834f47-x86_64.AppImage.zsync","label":"","uploader":{"login":"antony-jr","id":33930174,"node_id":"MDQ6VXNlcjMzOTMwMTc0","avatar_url":"https://avatars2.githubusercontent.com/u/33930174?v=4","gravatar_id":"","url":"https://api.github.com/users/antony-jr","html_url":"https://github.com/antony-jr","followers_url":"https://api.github.com/users/antony-jr/followers","following_url":"https://api.github.com/users/antony-jr/following{/other_user}","gists_url":"https://api.github.com/users/antony-jr/gists{/gist_id}","starred_url":"https://api.github.com/users/antony-jr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antony-jr/subscriptions","organizations_url":"https://api.github.com/users/antony-jr/orgs","repos_url":"https://api.github.com/users/antony-jr/repos","events_url":"https://api.github.com/users/antony-jr/events{/privacy}","received_events_url":"https://api.github.com/users/antony-jr/received_events","type":"User","site_admin":false},"content_type":"application/octet-stream","state":"uploaded","size":18818,"download_count":0,"created_at":"2019-11-26T04:18:30Z","updated_at":"2019-11-26T04:18:31Z","browser_download_url":"https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/appimageupdater-7834f47-x86_64.AppImage.zsync"}
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 8188k  100   207    0     0    651      0 --:--:-- --:--:-- --:--:--   652
{"message":"Validation Failed","request_id":"BACE:288E:2F74:3C15:5DDCA797","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"already_exists","field":"name"}]}
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 25025  100   207    0     0    628      0 --:--:-- --:--:-- --:--:--   627
  0 25025  100   207    0     0    628      0 --:--:-- --:--:-- --:--:--   627
{"message":"Validation Failed","request_id":"BAD0:0FA0:2D8C:390B:5DDCA797","documentation_url":"https://developer.github.com/v3","errors":[{"resource":"ReleaseAsset","code":"already_exists","field":"name"}]}
c974049d9cd689489683a2e118d0000d49e38b24dae241be5402cd2bec32580b  appimageupdater-7834f47-x86_64.AppImage
a4a0bc249a7b22a09f5136b4c3ef97c65b9b4530a06c5794127255bda83281ac  appimageupdater-7834f47-x86_64.AppImage.zsync
231c7d6b0b7533499550b25eeea37228045c275f3494ba9c552c8b7c324a6bbe  AppImageUpdater-7834f47-x86_64.AppImage
8faf672ad6915c354315e3bd20b9c7d8155a80a2eb1313d3a29c03e507853ae4  AppImageUpdater-7834f47-x86_64.AppImage.zsync
Publish the release...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  5566  100  5550  100    16  24973     71 --:--:-- --:--:-- --:--:-- 25000
{
  "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21754256",
  "assets_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/21754256/assets",
  "upload_url": "https://uploads.github.com/repos/antony-jr/AppImageUpdater/releases/21754256/assets{?name,label}",
  "html_url": "https://github.com/antony-jr/AppImageUpdater/releases/tag/continuous",
  "id": 21754256,
  "node_id": "MDc6UmVsZWFzZTIxNzU0MjU2",
  "tag_name": "continuous",
  "target_commitish": "7834f4747db5146266e1ee40101a1809e3d6bca0",
  "name": "Continuous build",
  "draft": false,
  "author": {
    "login": "antony-jr",
    "id": 33930174,
    "node_id": "MDQ6VXNlcjMzOTMwMTc0",
    "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/antony-jr",
    "html_url": "https://github.com/antony-jr",
    "followers_url": "https://api.github.com/users/antony-jr/followers",
    "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
    "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
    "organizations_url": "https://api.github.com/users/antony-jr/orgs",
    "repos_url": "https://api.github.com/users/antony-jr/repos",
    "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
    "received_events_url": "https://api.github.com/users/antony-jr/received_events",
    "type": "User",
    "site_admin": false
  },
  "prerelease": true,
  "created_at": "2019-11-26T03:52:29Z",
  "published_at": "2019-11-26T04:18:29Z",
  "assets": [
    {
      "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16399060",
      "id": 16399060,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDE2Mzk5MDYw",
      "name": "appimageupdater-7834f47-x86_64.AppImage",
      "label": "",
      "uploader": {
        "login": "antony-jr",
        "id": 33930174,
        "node_id": "MDQ6VXNlcjMzOTMwMTc0",
        "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/antony-jr",
        "html_url": "https://github.com/antony-jr",
        "followers_url": "https://api.github.com/users/antony-jr/followers",
        "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
        "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
        "organizations_url": "https://api.github.com/users/antony-jr/orgs",
        "repos_url": "https://api.github.com/users/antony-jr/repos",
        "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
        "received_events_url": "https://api.github.com/users/antony-jr/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/octet-stream",
      "state": "uploaded",
      "size": 6336552,
      "download_count": 0,
      "created_at": "2019-11-26T04:18:29Z",
      "updated_at": "2019-11-26T04:18:30Z",
      "browser_download_url": "https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/appimageupdater-7834f47-x86_64.AppImage"
    },
    {
      "url": "https://api.github.com/repos/antony-jr/AppImageUpdater/releases/assets/16399061",
      "id": 16399061,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDE2Mzk5MDYx",
      "name": "appimageupdater-7834f47-x86_64.AppImage.zsync",
      "label": "",
      "uploader": {
        "login": "antony-jr",
        "id": 33930174,
        "node_id": "MDQ6VXNlcjMzOTMwMTc0",
        "avatar_url": "https://avatars2.githubusercontent.com/u/33930174?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/antony-jr",
        "html_url": "https://github.com/antony-jr",
        "followers_url": "https://api.github.com/users/antony-jr/followers",
        "following_url": "https://api.github.com/users/antony-jr/following{/other_user}",
        "gists_url": "https://api.github.com/users/antony-jr/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/antony-jr/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/antony-jr/subscriptions",
        "organizations_url": "https://api.github.com/users/antony-jr/orgs",
        "repos_url": "https://api.github.com/users/antony-jr/repos",
        "events_url": "https://api.github.com/users/antony-jr/events{/privacy}",
        "received_events_url": "https://api.github.com/users/antony-jr/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/octet-stream",
      "state": "uploaded",
      "size": 18818,
      "download_count": 0,
      "created_at": "2019-11-26T04:18:30Z",
      "updated_at": "2019-11-26T04:18:31Z",
      "browser_download_url": "https://github.com/antony-jr/AppImageUpdater/releases/download/continuous/appimageupdater-7834f47-x86_64.AppImage.zsync"
    }
  ],
  "tarball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/tarball/continuous",
  "zipball_url": "https://api.github.com/repos/antony-jr/AppImageUpdater/zipball/continuous",
  "body": "Travis CI build log: https://travis-ci.org/antony-jr/AppImageUpdater/builds/617022116"
}

Add support for beta releases

It would be great to be able to set some environment variable to force a pre-release to be created instead of a "normal" release. Currently, this is only possible by setting $UPLOADTOOL_PREFIX to some value different from $TRAVIS_TAG, but that is quite counter-intuitive, and also applies some constraints that are not wanted (e.g., a prefix continuous- is added to the name of the release, which is not wanted for beta releases).

I would suggest an UPLOADTOOL_PRERELEASE environment variable to be added. That way, a Pre-release: $TRAVIS_TAG release would be created instead of Release: $TRAVIS_TAG.

Upload certain files as executable

It would be advantageous to keep certain files, that the downloading user is suppose to execute (for example *.AppImage and *.sh), as executable in the sense of Unix (chmod +x) on Github. So I am requesting a way to "chmod +x" a just uploaded file, if for example the file matches a particular pattern (*.AppImage, *.sh, ...). Or just to preserve the permission flags would also work (curl by nature squishes them).

Alternative way of publishing continuous builds

Just sharing something I have learned that you might be interested in knowing, assuming you don't know it already. Note that I'm not proposing any change or pointing out any bug in uploadtool.

I have recently learned that GitHub's wiki is also a git repository, and you can setup Travis-CI to upload nightly builds on each commit to some file sharing service (potentially signed by some Travis gpg key) and update wiki with those download links. Here is an example of someone doing this (this seems to be the code).

Pros:

  • uploadtool keeps only the last builds files, using a wiki you can check previous revisions and find builds of previous commits

Cons:

  • It's not on Releases page (though you could link to the wiki page in the release notes)
  • File sharing services don't keep files for long, generally a month or so, while GitHub seems to keep the forever

Allow for build matrices

Allow for uploading the build artifacts of build matrices (e.g., multiple architectures). For this, we need to check the commit sha of the current build and check whether there is already a release for the same sha. If it is, then do not delete the release and the tag, but upload additional binaries to it instead.

Do only one posting that contains all uploaded artifacts

@dirkhh this is what currently happens when there are many build artifacts:

spam

Especially with my avatar next to it, I am sure this makes me perceived a "spammer" in no time ;-)

There should be only one posting that contains all uploaded artifacts, rather than one per artifact.
Do you think this is possible?

Add build log to release description

I would appreciate if there was a link back to the Travis CI build log in the release description.

The functionality appears to be implemented, looking at the code, I am not sure why this isn't happening, though.

@probonopd could you please have a look why the URL isn't appended to the description?

Unit tests to prevent bad commits to pass

As seen in #10, some bugs might pass, leading to broken builds. We should add some tests.

There is no real "dummy" or "sandbox" GitHub API (like there is one for many other REST APIs, e.g. https://developer.paypal.com/docs/integration/direct/payments/test-the-api/), so the question is how to realize the tests.

In an example from the GitHub API docs they just have an extra repository whose sole purpose is to serve as a sandbox for API calls. However, I don't think that's really practicable, it'll generate a lot of unnecessary notifications etc.

An alternative is to set up a fake API server as a fixture for the tests. There's a bunch of possibilities, e.g., https://github.com/localmed/api-mock, https://github.com/typicode/json-server or https://github.com/basicallydan/interfake (did not test any of them, just the result of some searches). Also, we could roll our own based on a little Flask script.

Both options have pros and cons -- the real GitHub API will always provide the most realistic experience, whereas a fake API might not react to changes in the GitHub API spec in time. I'd probably go with writing a little Flask based API server, and redirect all the API calls to that service (e.g., by making the API address upload.sh uses configurable using an environment variable).

A tool used as widely as this one has to work reliably. And we all know untested code is broken code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.