forked from microsoft/VoTT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: pipeline for preview release (queue manually) (microsoft#879)
- Loading branch information
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops#job-templates-with-parameters | ||
jobs: | ||
- job: ${{ parameters.name }} | ||
pool: ${{ parameters.pool }} | ||
timeoutInMinutes: 15 # how long to run the job before automatically cancelling | ||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Use Node 10.x' | ||
inputs: | ||
versionSpec: 10.x | ||
|
||
- bash: | | ||
set -ex | ||
# clean install | ||
npm ci | ||
npm run release-ci | ||
OS=${{ parameters.os }} | ||
ARTIFACT_NAME=${{ parameters.artifact }} | ||
mkdir -p ${OS} | ||
cp releases/${ARTIFACT_NAME} ${OS}/ | ||
displayName: Build | ||
- publish: $(System.DefaultWorkingDirectory)/${{ parameters.os }} | ||
artifact: ${{ parameters.os }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
parameters: | ||
GitHubConnection: '' # defaults for any parameters that aren't specified | ||
repositoryName: '' | ||
releaseNotesSource: input | ||
addChangeLog: false | ||
isPreRelease: true | ||
isDraft: true | ||
|
||
jobs: | ||
- job: Create_Github_Release | ||
timeoutInMinutes: 30 # timeout on job if deploy is not completed in 30 minutes | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- checkout: none # we already have the artifacts built, don't need the code | ||
|
||
- download: current | ||
|
||
- task: GitHubRelease@0 | ||
displayName: 'GitHub release (create)' | ||
inputs: | ||
gitHubConnection: ${{ parameters.GitHubConnection }} | ||
repositoryName: ${{ parameters.repositoryName }} | ||
releaseNotesSource: ${{ parameters.releaseNotesSource }} | ||
target: $(Build.SourceBranch) | ||
assets: | | ||
../linux/* | ||
../windows/* | ||
../mac/* | ||
addChangeLog: ${{ parameters.addChangeLog }} | ||
isDraft: true # for testing, change to true when ready to merge | ||
isPreRelease: ${{ parameters.isPrelease }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
trigger: none # manual queue only when we're ready to release | ||
pr: none # disable CI build for PR | ||
|
||
stages: | ||
- stage: version_bump_commit | ||
jobs: | ||
- job: "version_bump" | ||
|
||
variables: | ||
- group: GitHub-Deploy-Creds | ||
|
||
timeoutInMinutes: 30 # timeout on job if deploy is not completed in 30 minutes | ||
cancelTimeoutInMinutes: 1 # time limit to wait for job to cancel | ||
|
||
pool: | ||
vmImage: macOS-10.13 # ssh key was generated on a Mac so using the same type of OS here | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: 10.x | ||
displayName: 'Install Node.js' | ||
|
||
# Download secure file | ||
# Download a secure file to the agent machine | ||
- task: DownloadSecureFile@1 | ||
# name: sshKey # The name with which to reference the secure file's path on the agent, like $(mySecureFile.secureFilePath) | ||
inputs: | ||
secureFile: vott_id_rsa | ||
|
||
# Install an SSH key prior to a build or deployment | ||
- task: InstallSSHKey@0 # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/install-ssh-key?view=azure-devops | ||
inputs: | ||
knownHostsEntry: $(KNOWN_HOSTS_ENTRY) | ||
sshPublicKey: $(SSH_PUBLIC_KEY) | ||
#sshPassphrase: # Optional | ||
sshKeySecureFile: vott_id_rsa | ||
env: | ||
KNOWN_HOSTS_ENTRY: $(KNOWN_HOSTS_ENTRY) | ||
SSH_PUBLIC_KEY: $(SSH_PUBLIC_KEY) # map to the right format (camelCase) that Azure credentials understand | ||
|
||
- task: Bash@3 | ||
name: BumpNpmVersion | ||
displayName: Bump NPM Prerelease Version | ||
inputs: | ||
targetType: filePath | ||
filePath: ./scripts/version-bump-commit.sh | ||
env: | ||
SOURCE_BRANCH: $(Build.SourceBranch) | ||
|
||
- stage: package_build | ||
dependsOn: version_bump_commit | ||
jobs: | ||
- template: azure-pipelines/templates/build-artifact.yml | ||
parameters: | ||
name: Linux | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
os: linux | ||
artifact: vott*.snap | ||
|
||
- template: azure-pipelines/templates/build-artifact.yml | ||
parameters: | ||
name: Windows | ||
pool: | ||
vmImage: vs2017-win2016 | ||
os: windows | ||
artifact: vott*.exe | ||
|
||
- template: azure-pipelines/templates/build-artifact.yml | ||
parameters: | ||
name: MacOS | ||
pool: | ||
vmImage: macOS-10.13 | ||
os: mac | ||
artifact: vott*.dmg | ||
|
||
- stage: github_release | ||
dependsOn: package_build | ||
jobs: | ||
- template: azure-pipelines/templates/create-github-release.yml | ||
parameters: | ||
GitHubConnection: 'GitHub connection' # defaults for any parameters that aren't specified | ||
repositoryName: 'Microsoft/VoTT' | ||
releaseNotesSource: input | ||
addChangeLog: false | ||
isPreRelease: true | ||
isDraft: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
NPM_RELEASE_TYPE=${1-"prepatch --preid=preview"} | ||
|
||
# Get full branch name excluding refs/head from the env var SOURCE_BRANCH | ||
SOURCE_BRANCH_NAME=${SOURCE_BRANCH/refs\/heads\/} | ||
|
||
# Configure git to commit as SLS Azure Functions Service Account | ||
echo "Configuring git to use deploy key..." | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Vott" | ||
|
||
echo "SOURCE_BRANCH: ${SOURCE_BRANCH_NAME}" | ||
git pull origin ${SOURCE_BRANCH_NAME} | ||
git checkout ${SOURCE_BRANCH_NAME} | ||
echo "Checked out branch: ${SOURCE_BRANCH_NAME}" | ||
|
||
NPM_VERSION=`npm version ${NPM_RELEASE_TYPE} -m "release: Update ${NPM_RELEASE_TYPE} version to %s ***NO_CI***"` | ||
echo "Set NPM version to: ${NPM_VERSION}" | ||
|
||
SHA=`git rev-parse HEAD` | ||
|
||
export GIT_SSH_COMMAND="ssh -vvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | ||
git remote add authOrigin [email protected]:microsoft/VoTT.git | ||
git push authOrigin ${SOURCE_BRANCH_NAME} --tags | ||
|
||
echo "Pushed new tag: ${NPM_VERSION} @ SHA: ${SHA:0:8}" |