Add ability to resolve snapshot latest date
Closes issue: https://github.com/swift-actions/setup-swift/issues/673
Implements resolution of development snapshots either by explicit date or by fetched tags from swiftlang/swift repo (similar to how Swiftly does this) by setting "main-snapshot" or "X.Y-snapshot" to swift-version parameter. It relies on setting GH_TOKEN value in env from secrect.GITHUB_TOKEN to avoid hitting limits.
Unites package information building under getPackage function. Includes tests for new functionality, including snapshot resolution with cached GitHub responses. Updated README with new options for versions and adding token.
Update.
Sorry for too many pushes that created pending jobs, I didn't know that it actually creates jobs within each push, thought needs approval for this. I've figured out how to setup locally most of the stack.
As for the implementation,
- It works for Ubuntu runners.
- ~Will try fix for macOS today-tomorrow.~ Fixed.
- ~Need to check if everything is fine for release versions.~ Seems to work OK.
Open questions without answer as for now:
- ~Current implementation requires GitHub API token in the repo, Swiftly manages to do this without token as it seems (need to look more how it handles that), and it is not really convenient to ask adding API key.~ OK, they rely on free request rates by default and allow to pass token to avoid getting hit by limits.
- Version of the Swift for snapshot is hardcoded right now in Package, the one used to check against already installed. - this puzzles me how to address, ~seems like this breaks caching as well~.
UPD. Unified code with what was running for stable versions, removing isStableRelease flag from the Package.
@fwal , have you been able to check this PR?