0% found this document useful (0 votes)
12 views2 pages

Roshan Pipeline Azure

Uploaded by

Roshan Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Roshan Pipeline Azure

Uploaded by

Roshan Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# Node.

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)

# Update App release date in Vercel


curl --request PATCH \
--url "https://api.vercel.com/v9/projects/${VERCEL_PROJ_NAME}/env/$
{VERCEL_VAR_ID_WINDOWS_LAST_UPDATED}?slug=${VERCEL_TEAM_SLUG}&teamId=$
{VERCEL_TEAM_ID}" \
--header "Authorization: Bearer ${VERCEL_TOKEN}" \
--header "Content-Type: application/json" \
--data '{
"comment": "Date of App update",
"key": "VITE_WINDOWS_LAST_UPDATED",
"target": [
"production",
"preview",
"development"
],
"type": "plain",
"value": "'"${APP_RELEASE_DATE}"'"
}'
displayName: 'Update Vercel Environment Variable APP release date'

You might also like