-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathazure-template-publish-job.yml
127 lines (123 loc) · 4.9 KB
/
azure-template-publish-job.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File: azure-template-publish-job.yml
# Date: 8-Jul-2019 jdw split out from original pipeline
#
# Update:
# 6-Aug-2019 jdw push source wheels (universal) for linux
# 17-May-2021 jdw add
#
##
parameters:
tox: ""
python: ""
os: "linux"
fixtures: ""
jobs:
- job: ${{ format('publish_{0}_{1}', parameters.tox, parameters.os) }}
pool:
${{ if eq(parameters.os, 'macos') }}:
vmImage: "macOS-latest"
${{ if eq(parameters.os, 'linux') }}:
vmImage: "ubuntu-latest"
dependsOn:
- ${{ format('build_test_{0}_{1}', parameters.tox, parameters.os) }}
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
#
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: ${{ parameters.python }}
addToPath: true
displayName: setup python
#
- checkout: self
submodules: true
persistCredentials: true
#
- download: current
artifact: ${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}
#- download: current
# artifact: ${{ format('sw_u_{0}_{1}', parameters.tox, parameters.os) }}
#
- script: ls -lR $(Pipeline.Workspace)/${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}
displayName: "Listing of downloaded artifacts"
#
- script: python -m pip install --upgrade pip twine setuptools wheel
displayName: "Install packaging tools"
#
- task: DownloadSecureFile@1
name: pypicred
displayName: "Download PyPI credentials"
inputs:
secureFile: "PYPIRC-AZURE"
- ${{ if startsWith(parameters.os, 'linux') }}:
- script: twine upload --verbose --skip-existing -r pypi --config-file $(pypicred.secureFilePath) $(Pipeline.Workspace)/${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}/*
displayName: "Linux upload sdist and source wheel to PyPi ..."
continueOnError: true
#
- ${{ if startsWith(parameters.os, 'macos') }}:
- script: twine upload --verbose --skip-existing -r pypi --config-file $(pypicred.secureFilePath) $(Pipeline.Workspace)/${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}/*
displayName: "Mac upload sdist and binary wheel to PyPi ..."
continueOnError: true
#
# Checkout and update documentation -
- script: pip install -r requirements.txt
displayName: "Install package dependencies"
- script: pip install -e .
displayName: "Install package locally"
- script: pip install -r requirements-doc.txt
displayName: "Install documentation dependencies"
#
#- script: |
# git config --global user.email "$env:GH_EMAIL"
# git config --global user.name "$env:GH_USER"
# git config --global credential.helper store
# echo https://$env:GH_TOKEN:[email protected]>>~/.git-credentials
# mkdocs gh-deploy
# env:
# GH_USER: $(GH_USER)
# GH_EMAIL: $(GH_EMAIL)
# GH_TOKEN: $(GH_TOKEN)
# REPO_URL: $(BUILD_REPOSITORY_URI)
# displayName: "Build and deploy documentation to GitHub pages"
##
#- script: |
# git config --global user.name "$env:GH_USER"
# git config --global user.email "$env:GH_EMAIL"
# echo "machine github.com login $env:GH_USER password $env:GH_TOKEN" > ~/.netrc
# mkdocs gh-deploy
# env:
# GH_USER: $(GH_USER)
# GH_EMAIL: $(GH_EMAIL)
# GH_TOKEN: $(GH_TOKEN)
# REPO_URL: $(BUILD_REPOSITORY_URI)
# displayName: "Build and deploy documentation to GitHub pages"
##
#- script: |
# AUTH=$(echo -n ":$env:GH_TOKEN" | openssl base64 | tr -d '\n')
# git config --global user.name "$env:GH_USER"
# git config --global user.email "$env:GH_EMAIL"
# git config --global http.$env:REPO_URL/.extraHeader "Authorization: Basic $AUTH"
# mkdocs gh-deploy
# env:
# GH_USER: $(GH_USER)
# GH_EMAIL: $(GH_EMAIL)
# GH_TOKEN: $(GH_TOKEN)
# REPO_URL: $(BUILD_REPOSITORY_URI)
# displayName: "Build and deploy documentation to GitHub pages"
- script: |
AUTH=$(echo -n ":$env:GH_TOKEN" | openssl base64 | tr -d '\n')
git config --global user.name "$env:GH_USER"
git config --global user.email "$env:GH_EMAIL"
git config --global http.$env:REPO_URL/.extraHeader "Authorization: Basic $AUTH"
git branch -D gh-pages
git checkout gh-pages
git pull --rebase
git checkout master
mkdocs build --clean
mkdocs gh-deploy
env:
GH_USER: $(GH_USER)
GH_EMAIL: $(GH_EMAIL)
GH_TOKEN: $(GH_TOKEN)
REPO_URL: $(BUILD_REPOSITORY_URI)
displayName: "Build and deploy documentation to GitHub pages"