Skip to content

Commit

Permalink
feat(release-to-candidate): Support projects that doesn't specify the…
Browse files Browse the repository at this point in the history
… `version` property

It is possible that the Snapcraft project doesn't specify the `version`
property in the snapcraft.yaml, instead setting the snap version string
via the `craftctl set version=_version` mechanism.  In this case the
parse-snapcraft-yaml job will set the version variable to `null`, making
the release-to-candidate job unable to detect the built snap due to
filename mismatch.

This patch enhances the release-to-candidate job so that the built
snap will still be matched via filename matching.

Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
  • Loading branch information
brlin-tw committed Aug 22, 2024
1 parent 4591701 commit 81969af
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions release-to-candidate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,27 @@ runs:
cat snapcraft-${name}*${arch}*.txt || echo "Could not find build log"
fi
if [[ ! -e "${name}_${version}_${arch}.snap" ]]; then
echo "Could not find ${name}_${version}_${arch}.snap"
snap_file=
if [[ "${version}" != "null" ]]; then
snap_file="${name}_${version}_${arch}.snap"
else
# snapcraft.yaml doesn't specify the _version_ property,
# matching it via globbing
snap_files=("${name}_"*"_${arch}.snap")
snap_file="${snap_files[0]}"
fi
if [[ ! -e "${snap_file}" ]]; then
echo "Could not find ${snap_file}"
exit 1
fi
popd || exit
# Write the manifest file which is used by later steps
echo "snap=${name}_${version}_${arch}.snap" >> "$GITHUB_OUTPUT"
echo "snap=${snap_file}" >> "$GITHUB_OUTPUT"
if [[ -n "$project_root" ]]; then
echo "snap=${project_root}/${name}_${version}_${arch}.snap" >> "$GITHUB_OUTPUT"
echo "snap=${project_root}/${snap_file}" >> "$GITHUB_OUTPUT"
fi
echo "name: ${name}" >> "manifest-${{ inputs.architecture }}.yaml"
echo "architecture: ${arch}" >> "manifest-${{ inputs.architecture }}.yaml"
Expand Down

0 comments on commit 81969af

Please sign in to comment.