121 строка
3.4 KiB
YAML
121 строка
3.4 KiB
YAML
# Copyright 2020 the .NET Foundation
|
|
# Licensed under the MIT License
|
|
|
|
# Setup steps for the build and deployment processes.
|
|
|
|
parameters:
|
|
- name: setupBuild
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: setupCranko
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: setupGit
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: setupNpm
|
|
type: boolean
|
|
default: false
|
|
|
|
steps:
|
|
- download: current
|
|
|
|
- checkout: self
|
|
submodules: recursive
|
|
|
|
- ${{ if parameters.setupCranko }}:
|
|
- bash: |
|
|
set -euo pipefail
|
|
d="$(mktemp -d /tmp/cranko.XXXXXX)"
|
|
cd "$d"
|
|
curl --proto '=https' --tlsv1.2 -sSf https://pkgw.github.io/cranko/fetch-latest.sh | sh
|
|
echo "##vso[task.prependpath]$d"
|
|
displayName: Install latest Cranko (not Windows)
|
|
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
|
|
|
|
- pwsh: |
|
|
$d = Join-Path $Env:Temp cranko-$(New-Guid)
|
|
[void][System.IO.Directory]::CreateDirectory($d)
|
|
cd $d
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://pkgw.github.io/cranko/fetch-latest.ps1'))
|
|
echo "##vso[task.prependpath]$d"
|
|
displayName: Install latest Cranko (Windows)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
|
|
# work around https://github.com/microsoft/azure-pipelines-tasks/issues/10653
|
|
# also note that `set -x` messes up `task.setvariable`
|
|
- bash: |
|
|
set -xeuo pipefail
|
|
|
|
BASH_WORKSPACE="$(Pipeline.Workspace)"
|
|
ARTIFACT_STAGING="$(Build.ArtifactStagingDirectory)"
|
|
|
|
if [[ $AGENT_OS == Windows_NT ]] ; then
|
|
BASH_WORKSPACE=$(echo "$BASH_WORKSPACE" | sed -e 's|\\|\/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/\L\1\E/\2|')
|
|
ARTIFACT_STAGING=$(echo "$ARTIFACT_STAGING" | sed -e 's|\\|\/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/\L\1\E/\2|')
|
|
fi
|
|
|
|
set +x
|
|
echo "##vso[task.setvariable variable=BASH_WORKSPACE;]$BASH_WORKSPACE"
|
|
echo "##vso[task.setvariable variable=ARTIFACT_STAGING;]$ARTIFACT_STAGING"
|
|
displayName: Ensure bash-friendly variable names
|
|
|
|
- bash: |
|
|
set -xeuo pipefail
|
|
git switch -c release
|
|
git pull --ff-only $BASH_WORKSPACE/git-release/release.bundle
|
|
displayName: Restore release commit
|
|
|
|
- ${{ if parameters.setupBuild }}:
|
|
- task: NodeTool@0
|
|
displayName: Set up node.js
|
|
inputs:
|
|
versionSpec: '>=12'
|
|
|
|
- bash: |
|
|
set -euo pipefail
|
|
|
|
if [[ $AGENT_OS == Windows_NT ]] ; then
|
|
CONDA=$(echo "$CONDA" | sed -e 's|\\|\/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/\L\1\E/\2|')
|
|
condabin="$CONDA/Scripts"
|
|
else
|
|
condabin="$CONDA/bin"
|
|
fi
|
|
|
|
if [[ $AGENT_OS == Darwin ]] ; then
|
|
sudo chown -R $USER $CONDA
|
|
fi
|
|
|
|
cat >activate-conda.sh <<EOF
|
|
eval "\$($condabin/conda shell.bash hook)"
|
|
conda activate
|
|
EOF
|
|
displayName: Set up Conda activation
|
|
|
|
- bash: |
|
|
set -euo pipefail
|
|
source activate-conda.sh
|
|
set -x
|
|
conda config --add channels conda-forge
|
|
conda config --set channel_priority strict
|
|
conda update -y --all
|
|
displayName: Activate conda-forge
|
|
|
|
- ${{ if parameters.setupGit }}:
|
|
- bash: |
|
|
cranko github install-credential-helper
|
|
displayName: Set up Git pushes
|
|
env:
|
|
GITHUB_TOKEN: $(GITHUB_TOKEN)
|
|
|
|
- ${{ if parameters.setupNpm }}:
|
|
- bash: |
|
|
cranko npm install-token
|
|
displayName: Set up NPM authentication
|
|
env:
|
|
NPM_TOKEN: $(NPM_TOKEN)
|