Skip to content

snap #281

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

Closed
wants to merge 3 commits into from
Closed

snap #281

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions cli/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: arduino-cli
summary: CLI tool.
description: a CLI for Arduino.

grade: stable
confinement: strict
base: core18

architectures:
- build-on: i386
- build-on: amd64
- build-on: armhf
- build-on: arm64

apps:
arduino-cli:
command: bin/arduino-cli
plugs:
- home
- network
- removable-media


parts:
arduino-cli:
plugin: cmake
source: https://github.com/arduino/arduino-cli.git
source-type: git
override-pull: |
git clone https://github.com/arduino/arduino-cli.git src/github.com/arduino/arduino-cli
cd src/github.com/arduino/arduino-cli
last_committed_tag="$(git describe --tags --abbrev=0)"
last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/v//')"
last_released_tag="$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == "beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
fi
snapcraftctl set-version "$(git describe --tags | sed 's/v//')"
override-build: |
export GOPATH=$PWD
cd src/github.com/arduino/arduino-cli
env CGO_ENABLED=0 GOOS=linux \
go build --ldflags "-s -w \
-X 'github.com/arduino/arduino-cli/version.GitCommit=$(git rev-list -1 HEAD)' \
-X 'github.com/arduino/arduino-cli/version.Version=$(git describe --tags --abbrev=0)'" \
-a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/arduino-cli
build-snaps:
- go
build-packages:
- git
- sed