mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
releaser: use GitHub CLI by default; remove option 'use-gh-cli'
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
Combined with a workflow that is executed periodically, **Releaser** allows to provide a fixed release name for users willing
|
||||
to use daily/nightly artifacts of a project.
|
||||
|
||||
Furthermore, when any [semver](https://semver.org) compilant tagged commit is pushed, **Releaser** can create a release and
|
||||
upload assets.
|
||||
Furthermore, when any [semver](https://semver.org) compilant tagged commit is pushed, **Releaser** can create a release
|
||||
and upload assets.
|
||||
|
||||
## Context
|
||||
|
||||
@@ -17,13 +17,16 @@ GitHub provides official clients for the GitHub API through [github.com/octokit]
|
||||
- [octokit.rb](https://github.com/octokit/octokit.rb) ([octokit.github.io/octokit.rb](http://octokit.github.io/octokit.rb))
|
||||
- [octokit.net](https://github.com/octokit/octokit.net) ([octokitnet.rtfd.io](https://octokitnet.rtfd.io))
|
||||
|
||||
When GitHub Actions was released in 2019, two Actions were made available through [github.com/actions](https://github.com/actions) for dealing with GitHub Releases:
|
||||
When GitHub Actions was released in 2019, two Actions were made available through
|
||||
[github.com/actions](https://github.com/actions) for dealing with GitHub Releases:
|
||||
|
||||
- [actions/create-release](https://github.com/actions/create-release)
|
||||
- [actions/upload-release-asset](https://github.com/actions/upload-release-asset)
|
||||
|
||||
However, those Actions were contributed by an employee in spare time, not officially supported by GitHub.
|
||||
Therefore, they were unmaintained before GitHub Actions was out of the private beta (see [actions/upload-release-asset#58](https://github.com/actions/upload-release-asset/issues/58)) and, a year later, archived.
|
||||
Therefore, they were unmaintained before GitHub Actions was out of the private beta
|
||||
(see [actions/upload-release-asset#58](https://github.com/actions/upload-release-asset/issues/58))
|
||||
and, a year later, archived.
|
||||
Those Actions are based on [actions/toolkit](https://github.com/actions/toolkit)'s hydrated version of octokit.js.
|
||||
|
||||
From a practical point of view, [actions/github-script](https://github.com/actions/github-script) is the natural replacement to those Actions, since it allows to use a pre-authenticated *octokit.js* client along with the workflow run context.
|
||||
@@ -80,52 +83,19 @@ jobs:
|
||||
README.md
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
GitHub's internal connections seem not to be very stable; as a result, uploading artifacts as assets does produce
|
||||
failures rather frequently, particularly if large tarballs are to be published.
|
||||
When failures are produced, some assets are left in a broken state within the release.
|
||||
**Releaser** tries to handle those cases by first uploading assets with a `tmp.*` name and then renaming them; if an existing
|
||||
`tmp.*` is found, it is removed and the upload is retried.
|
||||
Therefore, restarting the **Releaser** job should suffice for "fixing" a failing run.
|
||||
|
||||
Note:
|
||||
Currently, GitHub Actions does not allow restarting a single job.
|
||||
That is unfortunate, because **Releaser** is typically used as the last dependent job in the workflows.
|
||||
Hence, running **Releaser** again requires restarting the whole workflow.
|
||||
Fortunately, restarting individual jobs is expected to be supported on GitHub Actions in the future.
|
||||
See [github/roadmap#271](https://github.com/github/roadmap/issues/271) and [actions/runner#432](https://github.com/actions/runner/issues/432).
|
||||
|
||||
If the tip/nightly release generated with **Releaser** is broken, and restarting the run cannot fix it, the recommended
|
||||
procedure is the following:
|
||||
|
||||
1. Go to `https://github.com/<name>/<repo>/releases/edit/<tag>`.
|
||||
2. Edit the assets to:
|
||||
- Remove the ones with a warning symbol and/or named starting with `tmp.*`.
|
||||
- Or, remove all of them.
|
||||
3. Save the changes (click the `Update release` button) and restart the **Releaser** job in CI.
|
||||
5. If that does still not work, remove the release and restart the **Releaser** job in CI.
|
||||
|
||||
See also [eine/tip#160](https://github.com/eine/tip/issues/160).
|
||||
|
||||
Note:
|
||||
If all the assets are removed, or if the release itself is removed, tip/nightly assets won't be available for
|
||||
users until the workflow is successfully run.
|
||||
For instance, Action [setup-ghdl-ci](https://github.com/ghdl/setup-ghdl-ci) uses assets from [ghdl/ghdl: releases/tag/nightly](https://github.com/ghdl/ghdl/releases/tag/nightly).
|
||||
Hence, it is recommended to try removing the conflictive assets only, in order to maximise the availability.
|
||||
|
||||
### Composite Action
|
||||
|
||||
The default implementation of **Releaser** is a Container Action.
|
||||
Therefore, a pre-built container image is pulled before starting the job.
|
||||
Alternatively, a Composite Action version is available: `uses: pyTooling/Actions/releaser/composite@main`.
|
||||
The Composite version installs the dependencies on the host (the runner environment), instead of using a container.
|
||||
Both implementations are functionally equivalent from **Releaser**'s point of view; however, the Composite Action allows users
|
||||
to tweak the version of Python by using [actions/setup-python](https://github.com/actions/setup-python) before.
|
||||
Both implementations are functionally equivalent from **Releaser**'s point of view; however, the Composite Action allows
|
||||
users to tweak the version of Python by using [actions/setup-python](https://github.com/actions/setup-python) before.
|
||||
|
||||
## Options
|
||||
|
||||
All options can be optionally provided as environment variables: `INPUT_TOKEN`, `INPUT_FILES`, `INPUT_TAG`, `INPUT_RM` and/or `INPUT_SNAPSHOTS`.
|
||||
All options can be optionally provided as environment variables: `INPUT_TOKEN`, `INPUT_FILES`, `INPUT_TAG`, `INPUT_RM`
|
||||
and/or `INPUT_SNAPSHOTS`.
|
||||
|
||||
### token (required)
|
||||
|
||||
@@ -133,7 +103,8 @@ Token to make authenticated API calls; can be passed in using `{{ secrets.GITHUB
|
||||
|
||||
### files (required)
|
||||
|
||||
Either a single filename/pattern or a multi-line list can be provided. All the artifacts are uploaded regardless of the hierarchy.
|
||||
Either a single filename/pattern or a multi-line list can be provided. All the artifacts are uploaded regardless of the
|
||||
hierarchy.
|
||||
|
||||
For creating/updating a release without uploading assets, set `files: none`.
|
||||
|
||||
@@ -143,25 +114,28 @@ The default tag name for the tip/nightly pre-release is `tip`, but it can be opt
|
||||
|
||||
### rm
|
||||
|
||||
Set option `rm` to `true` for systematically removing previous artifacts (e.g. old versions). Otherwise (by default), all previours artifacts are preserved or overwritten.
|
||||
Set option `rm` to `true` for systematically removing previous artifacts (e.g. old versions).
|
||||
Otherwise (by default), all previours artifacts are preserved or overwritten.
|
||||
|
||||
Note:
|
||||
If all the assets are removed, or if the release itself is removed, tip/nightly assets won't be available for
|
||||
users until the workflow is successfully run.
|
||||
For instance, Action [setup-ghdl-ci](https://github.com/ghdl/setup-ghdl-ci) uses assets from [ghdl/ghdl: releases/tag/nightly](https://github.com/ghdl/ghdl/releases/tag/nightly).
|
||||
Hence, it is recommended to try removing the conflictive assets only, in order to maximise the availability.
|
||||
|
||||
### snapshots
|
||||
|
||||
Whether to create releases from any tag or to treat some as snapshots. By default, all the tags with non-empty `prerelease` field (see [semver.org: Is there a suggested regular expression (RegEx) to check a SemVer string?](https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string)) are considered snapshots; neither a release is created nor assets are uploaded.
|
||||
|
||||
### use-gh-cli
|
||||
|
||||
In order to work around the reliability issues explained in section *Troubleshooting* above, option *use-gh-cli* allows
|
||||
using GitHub's official command line tool ([cli/cli](https://github.com/cli/cli)) for uploading/updating assets.
|
||||
|
||||
IMPORTANT: Using this option requires the repository to be cloned (preferredly through [actions/checkout](https://github.com/actions/checkout)).
|
||||
Whether to create releases from any tag or to treat some as snapshots.
|
||||
By default, all the tags with non-empty `prerelease` field (see [semver.org: Is there a suggested regular expression (RegEx) to check a SemVer string?](https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string))
|
||||
are considered snapshots; neither a release is created nor assets are uploaded.
|
||||
|
||||
## Advanced/complex use cases
|
||||
|
||||
**Releaser** is essentially a very thin wrapper to use the GitHub Actions context data along with the classes
|
||||
and methods of PyGithub.
|
||||
|
||||
Similarly to [actions/github-script](https://github.com/actions/github-script), users with advanced/complex requirements might find it desirable to write their own Python script, instead of using **Releaser**.
|
||||
Similarly to [actions/github-script](https://github.com/actions/github-script), users with advanced/complex requirements
|
||||
might find it desirable to write their own Python script, instead of using **Releaser**.
|
||||
In fact, since `shell: python` is supported in GitHub Actions, using Python does *not* require any Action.
|
||||
For prototyping purposes, the following job might be useful:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user