push releases to github (#413)

Azure Pipelines has direct integration with GitHub, so we're just using
that. Releases on GitHub have to target a tag, so we also need to push
the tag as an intermediate step; we also need to include the platform
name in the artifact to avoid overwriting from different builds.

The two "GitHub release" steps depend on two Azure variables that are
not defined in the pipeline script. This may look like it should not
work, but in fact it does, because these variables are set by the
release script.

In Azure Pipelines, any build step can set variables for the next build
steps by outputting specially-formatted text to stdout. This text will
not appear in the build output displayed by Azure Pipelines, e.g.:

```
echo '##vso[task.setvariable variable=sauce]tomatoes'
```

would define the Azure variable `sauce` to have the string `tomatoes` as
its value for the next build steps.

See [0] for details.

[0]: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#set-in-script
This commit is contained in:
Gary Verhaegen 2019-04-12 11:30:13 +01:00 committed by GitHub
parent 3e154fd682
commit 6110d4be3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 18 deletions

View File

@ -26,6 +26,8 @@ jobs:
name: 'linux-pool'
steps:
- template: ci/build-unix.yml
parameters:
name: linux
- job: macOS
timeoutInMinutes: 360
@ -33,6 +35,8 @@ jobs:
vmImage: 'macOS-10.13'
steps:
- template: ci/build-unix.yml
parameters:
name: macos
- job: Windows
timeoutInMinutes: 360

View File

@ -1,5 +1,9 @@
parameters:
name: ''
steps:
- checkout: self
persistCredentials: true
- bash: ci/dev-env-install.sh
displayName: 'Build/Install the Developer Environment'
@ -40,3 +44,23 @@ steps:
env:
# to connect to bintray
JFROG_CONFIG_CONTENT: $(JFROG_CONFIG_CONTENT)
- bash: |
set -euxo pipefail
git tag -a v$(release_tag) -m "SDK $(release_tag)"
git push origin v$(release_tag)
cp bazel-genfiles/release/sdk-release-tarball.tar.gz ./daml-sdk-$(release_tag)-${{ parameters.name }}.tar.gz
condition: eq(variables['has_released'], 'true')
- task: GitHubRelease@0
condition: eq(variables['has_released'], 'true')
inputs:
gitHubConnection: 'garyverhaegen-da'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'auto'
assets: './daml-sdk-$(release_tag)-${{ parameters.name }}.tar.gz'
assetUploadMode: 'replace'
addChangeLog: false
- bash: |
rm ./daml-sdk-$(release_tag)-${{ parameters.name }}.tar.gz
condition: eq(variables['has_released'], 'true')

View File

@ -5,14 +5,14 @@
version.
1. Make a PR that only bumps the version number in the VERSION
file. It is important that the PR only changes the VERSION file.
1. Merge the PR using a rebase merge.
1. Once CI has passed for the merged PR, the release should be
available on bintray.
1. Squash the PR.
1. Once CI has passed for the corresponding master build, the release should be
available on bintray and GitHub, as well as properly tagged.
1. Activate the new version with `da use VERSION`. Note that it will
not be picked up by `da upgrade` at this point.
1. Run through the manual test plan described in https://docs.google.com/document/d/16amcy7bQodXSHjEmKhAUiaPf6O92gUbch1OyixDEvSM/edit?ts=5ca5be00.
1. If it passes the release should be made public. This currently
consists of three steps.
1. If it passes, the release should be made public. This currently
consists of two steps:
1. Tag the release as `visible-external` on Bintray. This step can
only be done by someone with permissions to set tags on Bintray.
@ -23,16 +23,3 @@
https://circleci.com/gh/DACH-NY/workflows/damlc-docker/tree/master
and click "rerun" on "master / Main Variant" and on "master / CircleCI Variant".
Once the jobs have passed, you should see two new images on https://hub.docker.com/r/digitalasset/daml-sdk/tags.
1. Tag the commit and push the tag:
```
git checkout master
# Checkout the release commit, you can use the following to
# find it assuming the commit message contains "release".
git log --grep=release -i
git checkout SHA_OF_RELEASE_COMMIT
git tag -a v0.11.31 -m "SDK 0.11.31" # Change the version number
git push origin v0.11.31
```
Verify that you see the tag at https://github.com/digital-asset/daml/releases.

View File

@ -44,6 +44,9 @@ main = do
$logInfo ("Writing slack release message to "# T.pack fp)
liftIO (BS.writeFile fp (T.encodeUtf8 (slackReleaseMessage os (renderVersion sdkVersion))))
releaseToBintray upload releaseDir artifacts
-- set variables for next steps in Azure pipelines
liftIO . putStrLn $ "##vso[task.setvariable variable=has_released]true"
liftIO . putStrLn . T.unpack $ "##vso[task.setvariable variable=release_tag]" # renderVersion sdkVersion
else do
$logInfo "Make dry run of release"
liftIO $ for_ optsSlackReleaseMessageFile (`BS.writeFile` "")