diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4597f667b..5d5f483da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,8 +54,6 @@ test-audit: build-linux: stage: build only: *releaseable_branches - variables: - CARGO_TARGET: x86_64-unknown-linux-gnu script: - scripts/gitlab/build-unix.sh <<: *collect_artifacts @@ -97,6 +95,23 @@ publish-docker: script: - scripts/gitlab/publish-docker.sh parity +publish-snap: + stage: publish + only: *releaseable_branches + image: parity/snapcraft:gitlab-ci + variables: + BUILD_ARCH: amd64 + cache: {} + before_script: *determine_version + dependencies: + - build-linux + tags: + - rust-stable + script: + - scripts/gitlab/publish-snap.sh + allow_failure: true + <<: *collect_artifacts + publish-awss3: stage: publish only: *releaseable_branches diff --git a/scripts/gitlab/publish-snap.sh b/scripts/gitlab/publish-snap.sh new file mode 100755 index 000000000..a664341e8 --- /dev/null +++ b/scripts/gitlab/publish-snap.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e # fail on any error +set -u # treat unset variables as error + +TRACK=`awk -F '=' '/^track/ {print $2}' ./util/version/Cargo.toml` + +case ${TRACK} in + nightly) export GRADE="devel" CHANNEL="edge";; + beta) export GRADE="stable" CHANNEL="beta";; + stable) export GRADE="stable" CHANNEL="stable";; + *) echo "No release" exit 0;; +esac + +SNAP_PACKAGE="parity_"$VERSION"_"$BUILD_ARCH".snap" + +echo "__________Create snap package__________" +echo "Release channel :" $GRADE " Branch/tag: " $CI_COMMIT_REF_NAME +echo $VERSION:$GRADE:$BUILD_ARCH +cat scripts/snap/snapcraft.template.yaml | envsubst '$VERSION:$GRADE:$BUILD_ARCH:$CARGO_TARGET' > snapcraft.yaml +cat snapcraft.yaml +snapcraft --target-arch=$BUILD_ARCH +ls *.snap + +echo "__________Calculating checksums__________" +rhash --sha256 $SNAP_PACKAGE -o $SNAP_PACKAGE".sha256" +cat $SNAP_PACKAGE".sha256" + +echo "__________Releasing snap package__________" +echo "Release channel :" $CHANNEL " Branch/tag: " $CI_COMMIT_REF_NAME + +echo $SNAPCRAFT_LOGIN_PARITY_BASE64 | base64 --decode > snapcraft.login +snapcraft login --with snapcraft.login +snapcraft push --release $CHANNEL $SNAP_PACKAGE +snapcraft status parity +snapcraft logout diff --git a/scripts/snap/icon.png b/scripts/snap/icon.png new file mode 100644 index 000000000..f0f22390f Binary files /dev/null and b/scripts/snap/icon.png differ diff --git a/scripts/snap/parity.desktop b/scripts/snap/parity.desktop new file mode 100644 index 000000000..1833865de --- /dev/null +++ b/scripts/snap/parity.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=Parity Ethereum +Comment=The fastest and most advanced Ethereum client. +Exec=parity +Icon=/usr/share/pixmaps/icon.png +Terminal=true diff --git a/scripts/snap/snapcraft.template.yaml b/scripts/snap/snapcraft.template.yaml new file mode 100644 index 000000000..eb67ba128 --- /dev/null +++ b/scripts/snap/snapcraft.template.yaml @@ -0,0 +1,57 @@ +name: parity +version: $VERSION +architectures: [$BUILD_ARCH] +grade: $GRADE +confinement: strict + +summary: Fast, light, robust Ethereum implementation +description: | + Parity's goal is to be the fastest, lightest, and most secure Ethereum + client. We are developing Parity using the sophisticated and cutting-edge + Rust programming language. Parity is licensed under the GPLv3, and can be + used for all your Ethereum needs. + +apps: + parity: + command: parity + plugs: [home, network, network-bind, mount-observe, x11, unity7, desktop, desktop-legacy, wayland] + desktop: ./usr/share/applications/parity.desktop + parity-evm: + command: parity-evm + plugs: [home, network, network-bind] + ethkey: + command: ethkey + plugs: [home] + ethstore: + command: ethstore + plugs: [home] + whisper: + command: whisper + plugs: [home, network-bind] + +icon: ./scripts/snap/icon.png + +parts: + desktop-icon: + source: ./scripts/snap + plugin: nil + override-build: | + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps + cp -v ./parity.desktop $SNAPCRAFT_PART_INSTALL/usr/share/applications/ + cp -v ./icon.png $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps/ + parity: + source: ./artifacts/$CARGO_TARGET + plugin: nil + override-build: | + mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin + cp -v parity $SNAPCRAFT_PART_INSTALL/usr/bin/parity + cp -v parity-evm $SNAPCRAFT_PART_INSTALL/usr/bin/parity-evm + cp -v ethkey $SNAPCRAFT_PART_INSTALL/usr/bin/ethkey + cp -v ethstore $SNAPCRAFT_PART_INSTALL/usr/bin/ethstore + cp -v whisper $SNAPCRAFT_PART_INSTALL/usr/bin/whisper + stage-packages: [libc6, libudev1, libstdc++6, cmake, libdb] + df: + plugin: nil + stage-packages: [coreutils] + stage: [bin/df]