Skip to content

Instantly share code, notes, and snippets.

@aryairani
Last active June 1, 2021 23:09
Show Gist options
  • Save aryairani/626d3297ad7a5894420e4caa15bda07d to your computer and use it in GitHub Desktop.
Save aryairani/626d3297ad7a5894420e4caa15bda07d to your computer and use it in GitHub Desktop.
- job: homebrew_template
dependsOn: multi_build
steps:
- task: DownloadBuildArtifacts@0
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-build-artifacts
inputs:
buildType: current
downloadType: specific
- script: |
osxhash=`shasum -a 256 $osxpkg | cut -d " " -f 1`
cat <<EOF >unison-language.rb
class UnisonLanguage < Formula
desc "The Unison Language and Codebase Manager."
homepage "https://unisonweb.org"
version "1.0.$version"
url "https://github.com/unisonweb/unison/releases/download/release%2F$version/unison-osx.tar.gz"
sha256 "$osxhash"
def install
opt_prefix.install Dir["*"]
bin.install_symlink opt_prefix/"ucm"
end
test do
system "ucm"
end
end
EOF
cat unison-language.rb
env:
version: $(Build.SourceBranchName)
linuxpkg: $(System.ArtifactsDirectory)/drop/unison-linux64.tar.gz
osxpkg: $(System.ArtifactsDirectory)/drop/unison-osx.tar.gz
displayName: generate unison-language.rb
- script: |
git clone https://aryairani:$(ghtoken)@github.com/unisonweb/homebrew-unison.git
pushd homebrew-unison
tag=release/$(Build.SourceBranchName)
cp ../unison-language.rb .
git add unison-language.rb
git config user.email "[email protected]"
git config user.name "azure pipeline"
git commit -m"update to $tag"
git push origin HEAD:master || \
(git push origin HEAD:$tag && \
echo "##vso[task.logissue type=warning;]couldn't push to master; pushed to $tag instead.")
displayName: commit unison-language.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment