generic-upstream-monitor¶
The generic-upstream-monitor workflow monitors upstream
for new versions of the packaged software.
It is meant to be used when the snapcraft.yaml file
lives outside the upstream source code
and should be kept in sync with upstream releases.
When a newer version is found upstream,
the workflow opens a GitHub issue titled
[CI] Found version '<version>' upstream
suggesting to update the snap.
If such an issue is already open, no new issue is created.
The workflow is “generic” in that it expects two caller-provided bash scripts:
script-get-upstream-versionretrieves the latest upstream version. It must print the version, and solely the version, to stdout.script-compare-versionscompares the version read from thesnapcraft.yamlto the upstream version. It is called with both versions as arguments:compare-versions <upstream-version> <snap-version>. It is expected to print1to stdout when the upstream version is greater than the snap version. Any other value is ignored.
Usage¶
jobs:
monitor:
permissions:
contents: read
issues: write
uses: canonical/robotics-actions-workflows/.github/workflows/generic-upstream-monitor.yaml@main
with:
script-get-upstream-version: |
curl -s https://example.com/latest-version.txt
script-compare-versions: |
if [ "${1}" -gt "${2}" ]; then
echo 1
fi
Inputs¶
Input |
Type |
Default |
Required |
Description |
|---|---|---|---|---|
|
string |
|
no |
The branch to checkout. |
|
string |
|
no |
Whom to assign the issue to, in the form |
|
string |
— |
yes |
A bash script to compare versions. |
|
string |
— |
yes |
A bash script to retrieve the upstream version. |
|
string |
|
no |
The directory of the Snapcraft project. |
Secrets¶
This workflow takes no secrets.
The GITHUB_TOKEN is used to open issues
and is available to the script-get-upstream-version script
as the GH_TOKEN environment variable.
Outputs¶
The workflow declares no workflow outputs and uploads no artifacts. Its outcome is a GitHub issue opened when a newer upstream version is detected.
Permissions¶
contents: readissues: write