public-transport / sample-gtfs-feed

An imaginary GTFS data set used for testing.
https://github.com/public-transport/sample-gtfs-feed
ISC License
11 stars 1 forks source link

Make GTFS.zip file available for download #5

Open 1Maxnet1 opened 1 year ago

1Maxnet1 commented 1 year ago

I like the idea of this repository, especially to have a valid GTFS-feed for testing your Software and making sure it is not the GTFS feed which makes a test fail, but rather your software. However, currently it would require my to download/clone the repository and build extract the gtfs.zip from the installed package. So a nice addition to this repo would imho be, if the current feed is available as gfts.zip in the Releases, so one can easily download them, if one is not interested in the module, but only in the sampl-feed.

derhuerst commented 1 year ago

It's not very obvious, but you can obtain a .tar.gz of the latest published npm package (which contains the built GTFS feed) using the npm registry API:

curl 'https://registry.npmjs.org/sample-gtfs-feed/latest' -H 'Accept: application/json' -fsSL | jq -rc .dist.tarball
# https://registry.npmjs.org/sample-gtfs-feed/-/sample-gtfs-feed-0.11.2.tgz

# or download it directly:
wget $('curl 'https://registry.npmjs.org/sample-gtfs-feed/latest' -H 'Accept: application/json' -fsSL | jq -rc .dist.tarball')

Do you think we should document this way? (It is less obvious, but less maintenance work for me.) Or should we use GitHub releases in addition?

1Maxnet1 commented 1 year ago

It's not very obvious, but you can obtain a .tar.gz of the latest published npm package (which contains the built GTFS feed) using the npm registry API:

curl 'https://registry.npmjs.org/sample-gtfs-feed/latest' -H 'Accept: application/json' -fsSL | jq -rc .dist.tarball
# https://registry.npmjs.org/sample-gtfs-feed/-/sample-gtfs-feed-0.11.2.tgz

# or download it directly:
wget $('curl 'https://registry.npmjs.org/sample-gtfs-feed/latest' -H 'Accept: application/json' -fsSL | jq -rc .dist.tarball')

Do you think we should document this way? (It is less obvious, but less maintenance work for me.) Or should we use GitHub releases in addition?

I did not have a closer look, but your given example does not work out-of-the-box in my (ZSH)-Shell. However, in general I would say this is rather more complicated for a user of the GTFS-Feed (although of course little to no maintenance for you). I would say a GitHub Release is more obvious and easier to use. Imagine one could also use this sample-GTFS for beginner tutorials and then downloading it from GitHub releases seems more user-friendly to me.

Or should we use GitHub releases in addition?

As you already tag releases, we could set a GitHub Action which does "just execute the two commands" and upload the GTFS-Feed as artifact to the tag, no? What do you think?

derhuerst commented 1 year ago

sounds good, PR welcome

1Maxnet1 commented 1 year ago

Got it on my to do list, will submit a PR soon :)

1Maxnet1 commented 1 year ago

I gave it some tries, but couldn't get it to work easily (https://github.com/1Maxnet1/sample-gtfs-feed/tree/add-gtfs-to-release) as I'm not that much experienced with GitHub Actions (yet). As it seems more work then I supposed, I will probably pause my work for now, keeping my branch for reference and will maybe come back to it, when I find time and will or have more experience with GitHub Actions :)

derhuerst commented 1 year ago

You don't have to download the .tar.gz file from npm. Instead, on push of a Git tag (e.g. 0.11.2), in a GitHub Actions workflow, you can

  1. Run npm run build to generate gtfs/*.txt.
  2. Zip all files (sth. like zip -9 -j sample-gtfs-feed.zip gtfs/*.txt).
  3. Create the release using the softprops/action-gh-release@v1 Action you're already using.