Adding version as a param to dev-deploy script (#239)

This commit is contained in:
Anshuman Goel
2020-11-02 11:05:13 -08:00
committed by GitHub
parent 2bc03855a2
commit 89ebc7be50

View File

@ -1,11 +1,16 @@
param (
[Parameter()]
[string] $app_dir="$PSScriptRoot",
[Parameter(Mandatory=$true)]
[string] $target
[string] $app_dir = "$PSScriptRoot",
# Specifying func app
[Parameter(Mandatory = $true)]
[string] $target,
# Specifying version for function
[Parameter(Mandatory = $false)]
[string]
$version = "0.0.0"
)
try {
try {
Push-Location
Set-Location "$app_dir/../pytypes"
python setup.py sdist bdist_wheel
@ -14,9 +19,11 @@ try {
Set-Location __app__
(New-Guid).Guid | Out-File onefuzzlib/build.id -Encoding ascii
(Get-Content -path "requirements.txt") -replace 'onefuzztypes==0.0.0', './onefuzztypes-0.0.0-py3-none-any.whl' | Out-File "requirements.txt"
(Get-Content -path "onefuzzlib/__version__.py") -replace '__version__ = "0.0.0"', "__version__ = ""$version""" | Out-File "onefuzzlib/__version__.py" -Encoding utf8
func azure functionapp publish $target --python
(Get-Content -path "onefuzzlib/__version__.py") -replace "__version__ = ""$version""", '__version__ = "0.0.0"' | Out-File "onefuzzlib/__version__.py" -Encoding utf8
(Get-Content -path "requirements.txt") -replace './onefuzztypes-0.0.0-py3-none-any.whl', 'onefuzztypes==0.0.0' | Out-File "requirements.txt"
Remove-Item 'onefuzztypes-0.0.0-py3-none-any.whl'
Remove-Item 'onefuzztypes-*-py3-none-any.whl'
Get-Content 'onefuzzlib/build.id'
}
finally {