From afbb5553b827cc82aecfb32ef8820786dba0e68a Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 21 Sep 2019 18:59:29 +0200 Subject: [PATCH] Add automatic deploy to Homebrew on CI --- azure-pipelines.yml | 1 + ci/build-macos.yml | 1 + ci/publish-homebrew.yml | 23 +++++++++++++++++++++++ packager/mac/espanso.rb | 2 +- src/config/runtime.rs | 5 ----- 5 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 ci/publish-homebrew.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b53eadb..c8d63ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,6 +26,7 @@ jobs: - template: ci/test.yml - template: ci/build-macos.yml - template: ci/deploy.yml + - template: ci/publish-homebrew.yml - job: Windows pool: diff --git a/ci/build-macos.yml b/ci/build-macos.yml index fc3fdbc..ea7bee9 100644 --- a/ci/build-macos.yml +++ b/ci/build-macos.yml @@ -13,5 +13,6 @@ steps: set -e python packager.py build cp target/packager/mac/espanso-*.gz . + cp target/packager/mac/espanso.rb . ls -la displayName: "Cargo build and packaging for MacOS" \ No newline at end of file diff --git a/ci/publish-homebrew.yml b/ci/publish-homebrew.yml new file mode 100644 index 0000000..bfbd21e --- /dev/null +++ b/ci/publish-homebrew.yml @@ -0,0 +1,23 @@ +parameters: + github: + gitHubConnection: "MyGithubConnection" + +steps: + - task: InstallSSHKey@0 + inputs: + knownHostsEntry: "|1|O7/oHnAkobor3z8tAi95ahYk64o=|QNEcrbUqutXSvEaPDYdiOgR4yV0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" + sshPublicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsB9zcHN84/T5URAsfIpb52HnJl2kUK7WWXyV9pFXaO6yz722JxzVq56J3TTrcUCDhM3DKSGKivB6n/tmLw4mefcY3t7kh8puAtaNrNnB4TWqVPFHZtnpYuYslp1rM92r7Bz1FHfVfsDZxqSWlGU/lp0gNEEgXbr2PCExbCh3TGTsKePARhMAtPEvyEZk1+8uA/HvUTjhuDp7P+BbejAsqtgVF0QoEvqDE5af8DZY6+i1cHRgwBYgSnOus8FHsZUGMyAJQtb+dD7imGw/nzokPJzbmQJwQetyhp52CfThpAm12EFtIU43imb8nndlVAmsIHF6czbmI5LP3U0UcTLct freddy@freddy-Z97M-DS3H" + sshKeySecureFile: "azuressh" + - script: | + set -ex + git config --global user.email "federicoterzi96@gmail.com" + git config --global user.email "Federico Terzi" + VER=$(cat Cargo.toml| grep version -m 1 | awk -F '"' '{ print $2 }') + git clone git@github.com:federico-terzi/homebrew-espanso.git + rm homebrew-espanso/Formula/espanso.rb + cp espanso.rb homebrew-espanso/Formula/espanso.rb + cd homebrew-espanso + git add -A + git commit -m "Update to version: $VER" + git push + displayName: "Publishing to Homebrew" \ No newline at end of file diff --git a/packager/mac/espanso.rb b/packager/mac/espanso.rb index 66c584b..6e7f477 100644 --- a/packager/mac/espanso.rb +++ b/packager/mac/espanso.rb @@ -4,7 +4,7 @@ class Espanso < Formula desc "{{{app_desc}}}" homepage "{{{app_url}}}" - url "{{{app_release_url}}}" + url "https://github.com/federico-terzi/espanso/releases/latest/download/espanso-mac.tar.gz" sha256 "{{{release_hash}}}" version "{{{app_version}}}" diff --git a/src/config/runtime.rs b/src/config/runtime.rs index a4e2784..e817352 100644 --- a/src/config/runtime.rs +++ b/src/config/runtime.rs @@ -468,9 +468,4 @@ mod tests { assert_eq!(config_manager.calculate_active_config().name, "firefox"); assert_eq!(config_manager.active_config().name, "default"); } - - #[test] - fn test_should_fail() { - assert!(false); - } } \ No newline at end of file