Skip to content

Commit

Permalink
Pass version number to build-chocolatey and update-homebrew
Browse files Browse the repository at this point in the history
Instead of always grabbing the Yarn version number from yarnpkg.com, allow it to be passed in as command line argument.
Updates Jenkins bump-version job to pass it in.

References yarnpkg/website#471
  • Loading branch information
Daniel15 committed Apr 29, 2017
1 parent a5b9cac commit 3514cb2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
21 changes: 15 additions & 6 deletions jenkins_jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ job('yarn-version') {
branch 'origin', 'master'
pushOnlyIfSuccess
}
downstreamParameterized {
// Other jobs to run when version number is bumped
trigger([
'yarn-chocolatey',
'yarn-homebrew',
]) {
parameters {
currentBuild()
}
}
}
gitHubIssueNotifier {
}
}
Expand Down Expand Up @@ -71,16 +82,15 @@ job('yarn-chocolatey') {
scm {
github 'yarnpkg/yarn', 'master'
}
triggers {
upstream 'yarn-version'
parameters {
stringParam 'YARN_VERSION'
}
steps {
powerShell '.\\scripts\\build-chocolatey.ps1 -Publish'
}
publishers {
gitHubIssueNotifier {
}
mailer '[email protected]'
}
}

Expand All @@ -90,15 +100,14 @@ job('yarn-homebrew') {
scm {
github 'yarnpkg/yarn', 'master'
}
triggers {
upstream 'yarn-version'
parameters {
stringParam 'YARN_VERSION'
}
steps {
shell './scripts/update-homebrew.sh'
}
publishers {
gitHubIssueNotifier {
}
mailer '[email protected]'
}
}
10 changes: 9 additions & 1 deletion scripts/build-chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ param(

$ErrorActionPreference = 'Stop'; # stop on all errors

$latest_version = [String](Invoke-WebRequest -Uri https://yarnpkg.com/latest-version -UseBasicParsing)
# See if YARN_VERSION was passed in the environment, otherwise get version
# number from Yarn site
if ($Env:YARN_VERSION) {
$latest_version = $Env:YARN_VERSION
} else {
Write-Output 'Getting Yarn version from https://yarnpkg.com/latest-version'
$latest_version = [String](Invoke-WebRequest -Uri https://yarnpkg.com/latest-version -UseBasicParsing)
}

$latest_chocolatey_version = (Find-Package -Name Yarn).Version

if ([Version]$latest_chocolatey_version -ge [Version]$latest_version) {
Expand Down
9 changes: 8 additions & 1 deletion scripts/update-homebrew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@

set -ex

version=`curl --fail https://yarnpkg.com/latest-version`
# See if YARN_VERSION was passed in the environment, otherwise get version
# number from Yarn site
if [ -z "$YARN_VERSION" ]; then
echo 'Getting Yarn version from https://yarnpkg.com/latest-version'
version=`curl --fail https://yarnpkg.com/latest-version`
else
version="$YARN_VERSION"
fi

# Ensure Linuxbrew is on the PATH
PATH=$PATH:$HOME/.linuxbrew/bin/
Expand Down

0 comments on commit 3514cb2

Please sign in to comment.