starship/ci/github-release.yml

167 lines
7.5 KiB
YAML

parameters:
rust_version: stable
github:
isPreRelease: false
repositoryName: "$(Build.Repository.Name)"
dependsOn: []
displayName: "Release to github"
tarCompression: "none"
archiveType: "zip"
archiveName: "$(Build.Repository.Name)"
jobs:
- job: ${{ parameters.name }}
condition: ${{ parameters.condition }}
displayName: ${{ parameters.displayName }}
dependsOn: ${{ parameters.dependsOn }}
pool:
vmImage: ubuntu-16.04
steps:
- template: install-cross-rust.yml
- bash: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date and tag variables"
- ${{ each build_target in parameters.targets }}:
- ? ${{ if not(or(eq(build_target, 'x86_64-apple-darwin'), eq(build_target, 'x86_64-pc-windows-msvc'))) }}
: - script: |
echo Start building ${{ build_target }}
cross build --target ${{ build_target }} --release
ls -l
ls -l target/${{ build_target }}/release/*
displayName: Relase build for target ${{ build_target }}
- task: CopyFiles@2
displayName: Copy files for target ${{ build_target }}
inputs:
sourceFolder: "$(Build.SourcesDirectory)/target/${{ build_target }}/release"
contents: ${{ parameters.contents }}
targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}"
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}"
archiveType: ${{ parameters.archiveType }}
tarCompression: ${{ parameters.tarCompression }}
archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.zip"
- task: GitHubRelease@0
displayName: Create release
inputs:
gitHubConnection: ${{ parameters.github.gitHubConnection }}
tagSource: manual
title: "$(build.my_tag) - $(build.date)"
tag: "$(build.my_tag)"
assetUploadMode: replace
action: edit
assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*"
repositoryName: ${{ parameters.github.repositoryName }}
isPreRelease: ${{ parameters.github.isPreRelease }}
- ${{ each build_target in parameters.targets }}:
- ${{ if eq(build_target, 'x86_64-apple-darwin') }}:
- job: ${{ parameters.name }}_macOS
condition: ${{ parameters.condition }}
displayName: ${{ parameters.displayName }} (macOS)
dependsOn: ${{ parameters.dependsOn }}
pool:
vmImage: macOS-10.13
steps:
- template: install-rust.yml
- bash: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date and tag variables"
- script: |
echo Start building ${{ build_target }}
cargo build --release
ls -l
ls -l target/release/*
displayName: Relase build for target ${{ build_target }}
- task: CopyFiles@2
displayName: Copy files for target ${{ build_target }}
inputs:
sourceFolder: "$(Build.SourcesDirectory)/target/release"
contents: ${{ parameters.contents }}
targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}"
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}"
archiveType: ${{ parameters.archiveType }}
tarCompression: ${{ parameters.tarCompression }}
archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.zip"
- task: GitHubRelease@0
displayName: Create release
inputs:
gitHubConnection: ${{ parameters.github.gitHubConnection }}
tagSource: manual
title: "$(build.my_tag) - $(build.date)"
tag: "$(build.my_tag)"
assetUploadMode: replace
action: edit
assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*"
repositoryName: ${{ parameters.github.repositoryName }}
isPreRelease: ${{ parameters.github.isPreRelease }}
- ${{ if eq(build_target, 'x86_64-pc-windows-msvc') }}:
- job: ${{ parameters.name }}_msvc
condition: ${{ parameters.condition }}
displayName: ${{ parameters.displayName }} (Windows)
dependsOn: ${{ parameters.dependsOn }}
pool:
vmImage: vs2017-win2016
steps:
- template: install-rust.yml
- bash: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date and tag variables"
- script: |
echo Start building ${{ build_target }}
cargo build --release
ls -l
ls -l target/release/*
displayName: Relase build for target ${{ build_target }}
- task: CopyFiles@2
displayName: Copy files for target ${{ build_target }}
inputs:
sourceFolder: "$(Build.SourcesDirectory)/target/release"
contents: ${{ parameters.contents }}
targetFolder: "$(Build.BinariesDirectory)/${{ build_target }}"
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: "$(Build.BinariesDirectory)/${{ build_target }}"
archiveType: ${{ parameters.archiveType }}
tarCompression: ${{ parameters.tarCompression }}
archiveFile: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}-$(build.my_tag)-${{ build_target }}.zip"
- task: GitHubRelease@0
displayName: Create release
inputs:
gitHubConnection: ${{ parameters.github.gitHubConnection }}
tagSource: manual
title: "$(build.my_tag) - $(build.date)"
tag: "$(build.my_tag)"
assetUploadMode: replace
action: edit
assets: "$(Build.ArtifactStagingDirectory)/${{ parameters.archiveName }}*"
repositoryName: ${{ parameters.github.repositoryName }}
isPreRelease: ${{ parameters.github.isPreRelease }}