Skip to content

Instantly share code, notes, and snippets.

@JoneSabino
Last active September 3, 2020 18:43
Show Gist options
  • Save JoneSabino/d951a2f6bd4092f1b184496521efaecf to your computer and use it in GitHub Desktop.
Save JoneSabino/d951a2f6bd4092f1b184496521efaecf to your computer and use it in GitHub Desktop.
$env = $Env:AMBIENTE
$scriptpath = $MyInvocation.MyCommand.Path
$curdir = Split-Path $scriptpath
Set-Location $curdir
if($env -eq 'HML')
{
Write-Output "Environment: $env"
$releaseBranch = git branch -r | Select-String "release"
$localReleaseBranch = $releaseBranch -replace "origin/", ""
Write-Output "Using: $localReleaseBranch"
git fetch origin $localReleaseBranch.Trim()
git checkout FETCH_HEAD
}
elseif($env -eq 'PRD')
{
Write-Output "Environment: $env"
git fetch --tags
$tag = git describe --tags $(git rev-list --tags --max-count=1)
Write-Output "Release $tag"
git checkout $tag -B latest
}
Write-Output "Instalando dependências do projeto"
pipenv sync -d
Write-Output "Iniciando a execucao do robô"
pipenv run robot
param (
# [Parameter(Mandatory=$true)][string]$env = 'HML'
[string]$env = 'HML'
# [string]$env = $( Read-Host "Por favor, insira o ambiente" )
)
$scriptpath = $MyInvocation.MyCommand.Path
$curdir = Split-Path $scriptpath
Set-Location $curdir
if($env -eq 'HML')
{
Write-Output "Environment: $env"
$releaseBranch = git branch -r | Select-String "release"
$localReleaseBranch = $releaseBranch -replace "origin/", ""
Write-Output "Using: $localReleaseBranch"
git fetch origin $localReleaseBranch.Trim()
git checkout FETCH_HEAD
}
elseif($env -eq 'PRD')
{
Write-Output "Environment: $env"
git fetch --tags
$tag = git describe --tags $(git rev-list --tags --max-count=1)
Write-Output "Release $tag"
git checkout $tag -B latest
}
if ( -not ( Test-Path -LiteralPath '.\venv' -PathType Container))
{
Write-Output "Ambiente virtual não existente, criando..."
virtualenv venv
}
Write-Output "Ativando ambiente virtual"
.\venv\Scripts\activate.ps1
Write-Output "Instalando dependencias do projeto"
pip install --quiet -r requirements.txt
Write-Output "Iniciando a execucao do robo"
python -u .\main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment