Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new remote-builder backend and misc improvement #36

Merged
merged 11 commits into from
Apr 22, 2024
1 change: 1 addition & 0 deletions release-to-candidate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
| `channel` | The channel to release the snap to. | N | `latest/candidate` |
| `launchpad-token` | A token with permissions to create Launchpad remote builds. | Y | |
| `repo-token` | A token with privileges to create and push tags to the repository. | Y |
| `show-build-log` | Show the build log even if the build succeed | N | `'true'` |
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved
| `snapcraft-project-root` | The path to the Snapcraft YAML file. | N | |
| `snapcraft-channel` | The channel to install Snapcraft from. | N | `latest/stable` |
| `store-token` | A token with permissions to upload and release to the specified channel in the Snap Store | Y | |
Expand Down
16 changes: 14 additions & 2 deletions release-to-candidate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ branding:
color: orange

inputs:
show-build-log:
description: "Show the build log even if the build succeed"
default: "true"
required: false
architecture:
description: "The architecture to build the snap for"
default: amd64
Expand Down Expand Up @@ -65,6 +69,8 @@ runs:
id: build
shell: bash
env:
SNAPCRAFT_REMOTE_BUILD_STRATEGY: "disable-fallback"
soumyaDghosh marked this conversation as resolved.
Show resolved Hide resolved
show_build_log: ${{ inputs.show-build-log }}
jnsgruk marked this conversation as resolved.
Show resolved Hide resolved
arch: ${{ inputs.architecture }}
name: ${{ steps.snapcraft-yaml.outputs.snap-name }}
yaml_path: ${{ steps.snapcraft-yaml.outputs.yaml-path }}
Expand All @@ -75,12 +81,15 @@ runs:
# https://bugs.launchpad.net/snapcraft/+bug/1885150
yq -i '.architectures |= [{"build-on": env(arch)}]' "$yaml_path"

cd "$project_root" || exit
cd "$project_root" && git init || exit
jnsgruk marked this conversation as resolved.
Show resolved Hide resolved
if ! snapcraft remote-build --launchpad-accept-public-upload; then
cat "${name}_${arch}.txt"
fi

cat "${name}_${arch}.txt"
# Check if build log is requested
if [[ "$show_build_log" == "true" ]]; then
cat "${name}_${arch}.txt"
fi

if [[ ! -e "${name}_${version}_${arch}.snap" ]]; then
echo "Could not find ${name}_${version}_${arch}.snap"
Expand All @@ -89,6 +98,9 @@ runs:

# Write the manifest file which is used by later steps
echo "snap=${name}_${version}_${arch}.snap" >> "$GITHUB_OUTPUT"
if [[ -n "$project_root" ]]; then
echo "snap=${project_root}/${name}_${version}_${arch}.snap" >> "$GITHUB_OUTPUT"
fi
echo "name: ${name}" >> "manifest-${arch}.yaml"
echo "architecture: ${arch}" >> "manifest-${arch}.yaml"

Expand Down