浏览代码

Merge branch 'gitlab-ci-snap2' into 'master'

Enable and fix snap package release job, mention snap package in README

See merge request timvisee/ffsend!13
Tim Visée 6 年之前
父节点
当前提交
68410e9614
共有 3 个文件被更改,包括 35 次插入21 次删除
  1. 27 19
      .gitlab-ci.yml
  2. 7 0
      README.md
  3. 1 2
      pkg/snap/snapcraft.yaml

+ 27 - 19
.gitlab-ci.yml

@@ -155,6 +155,33 @@ crate:
     - echo "Publishing crate to crates.io..."
     - cargo publish --verbose --allow-dirty
 
+# Snap release
+snap:
+  image: snapcore/snapcraft:edge
+  stage: release
+  only:
+    - /^v(\d+\.)*\d+$/
+  before_script: []
+  script:
+    # Prepare the environment
+    - apt-get update -y
+    - cd pkg/snap
+
+    # Update version number in snapcraft.yml
+    - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
+    - echo "Determined binary version number 'v$VERSION', updating snapcraft.yml..."
+    - 'sed "s/^version:.*\$/version: $VERSION/" -i snapcraft.yml'
+    - 'sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i snapcraft.yml'
+
+    # Build the package
+    - echo "Building snap package..."
+    - snapcraft
+
+    # Publish snap package
+    - echo "Publishing snap package..."
+    - echo "$SNAP_MAIL\n&SNAP_PASSWORD" | snapcraft login
+    - snapcraft push --release=stable ffsend_*_amd64.snap
+
 # Publish release binaries to as GitHub release
 github-release:
   stage: release
@@ -255,23 +282,4 @@ package-aur:
 #     - export VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-)
 #     - 'curl -L -H "Content-Type: application/json" -H "Authorization: Bearer $APPVEYOR_TOKEN" -d "{\"accountName\":\"timvisee\",\"projectSlug\":\"ffsend\",\"tag\":\"$CI_COMMIT_REF_NAME\",\"environmentVariables\":{\"FFSEND_VERSION\":\"$VERSION\"}}" https://ci.appveyor.com/api/builds'
 
-# # Snap release
-# snap:
-#   image: snapcore/snapcraft:edge
-#   stage: release
-#   # only:
-#   #   - /^v(\d+\.)*\d+$/
-#   before_script: []
-#   script:
-#     - echo "Building snap package..."
-#     - cd pkg/snap
-#     - snapcraft
-#     # TODO: See: https://docs.snapcraft.io/rust-applications/7826
-#     # TODO: - login to registry
-#     # TODO: - test built snap
-#     # TODO: - push snap to snapcraft.io
-#     # - echo "Publishing snap package..."
-#     # - echo "$SNAP_USER\n&SNAP_PASS" | snapcraft login
-#     # - snapcraft push --release=edge ffsend_amd64.snap
-
 # TODO: add job to test ffsend{-git} AUR packages

+ 7 - 0
README.md

@@ -152,6 +152,12 @@ available right now.
 It is recommended to build and install `ffsend` yourself using these fairly
 easy steps [below](#build).
 
+#### Snap package
+[» `ffsend`][snapcraft-ffsend]
+```bash
+snap install ffsend
+```
+
 #### Arch AUR package
 [» `ffsend`][aur-ffsend] (binary package)  
 [» `ffsend-git`][aur-ffsend-git] (compile from source package)
@@ -433,3 +439,4 @@ Check out the [LICENSE](LICENSE) file for more information.
 [github-latest-release]: https://github.com/timvisee/ffsend/releases/latest
 [aur-ffsend]: https://aur.archlinux.org/packages/ffsend/
 [aur-ffsend-git]: https://aur.archlinux.org/packages/ffsend-git/
+[snapcraft-ffsend]: https://snapcraft.io/ffsend

+ 1 - 2
pkg/snap/snapcraft.yaml

@@ -27,6 +27,5 @@ parts:
     source: ../../
     plugin: rust
     build-attributes: [no-system-libraries]
-    build-packages: [make, cmake, pkg-config]
-    # build-packages: [g++, libudev-dev, libssl-dev, make, pkg-config]
+    build-packages: [make, cmake, pkg-config, libssl-dev]
     stage-packages: [libssl1.0.0, xclip]