Roshan Pipeline Azure
Roshan Pipeline Azure
js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- develop
pool:
vmImage: ubuntu-latest
variables:
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
APP_NAME: 'Pebble_QAA.exe'
steps:
- task: NodeTool@0
inputs:
versionSpec: '20.x'
displayName: 'Install Node.js'
- script: |
npm install
npm install pnpm
pip install awscli --upgrade --user
displayName: 'install required packages'
- task: CmdLine@2
inputs:
script: 'npm run build:win'
displayName: 'Build the windows'
- task: CmdLine@2
inputs:
script: |
set EXE_FILE=
for /f "delims=" %%i in ('dir /s /od *.exe') do set EXE_FILE=%%i
if defined EXE_FILE (
mkdir build 2>nul
move /Y "%EXE_FILE%" build\${APP_NAME}
) else (
echo "No executable file found!"
exit /b 1
)
displayName: 'Find the Most Recent Executable and rename'
- task: CmdLine@2
inputs:
script: |
set AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID)
set AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY)
echo Uploading Pebble.exe to S3 bucket...
aws s3 cp ./build/$(APP_NAME) s3://$(S3_BUCKET)/pebble-apps/ --
region $(AWS_DEFAULT_REGION)
# Construct the S3 URL
set APP_URL=$(S3_URL)/$(APP_NAME)
echo $(APP_URL)
displayName: 'Upload App to S3'
- task: CmdLine@2
inputs:
script: |
curl --request PATCH ^
--url "https://api.vercel.com/v9/projects/$(QAA_PROJ_ID)/env/$(ENV_VAR_ID)?
slug=$(TEAM_SLUG)&teamId=$(TEAM_ID)" ^
--header "Authorization: Bearer $(VERCEL_TOKEN)" --header "Content-Type:
application/json" ^
--data '{
"comment": "URL of the app",
"key": "VITE_WINDOWS_DOWNLOAD_LINK",
"target": [
"production"
],
"type": "plain",
"value": "$(APP_URL)"
}'
displayName: 'Update Vercel Environment Variable APP URL'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
# Get the current date in dd-mm-yyyy format
APP_RELEASE_DATE=$(date +%d-%m-%Y)