Skip to content

Commit

Permalink
CI: Add pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Apr 8, 2022
1 parent 53d6ad6 commit 3e2a106
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .ci/azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Azure Pipeline YAML file

name: 1.0.0$(Rev:.r)

trigger:
batch: true
branches:
include:
- master
tags:
include:
- '*'

pr:
drafts: false

variables:
_IS_BUILD_CANARY: false
_RELEASE_NAME: 7thHeavenCatalogs
_RELEASE_VERSION: v0
_BUILD_VERSION: $(Build.BuildNumber)
_BUILD_BRANCH: $(Build.SourceBranch)

pool:
vmImage: 'windows-2022'

steps:
- checkout: self
- task: PowerShell@2
displayName: 'Prepare $(_RELEASE_NAME) Env'
inputs:
filePath: $(Build.Repository.LocalPath)\.ci\prepare.ps1
- task: GitHubRelease@0
condition: and(eq(variables._IS_BUILD_CANARY, 'true'), not(contains(variables._BUILD_BRANCH, 'refs/pull/')), succeeded())
displayName: 'Delete $(_RELEASE_NAME) Release (Canary)'
continueOnError: true
inputs:
gitHubConnection: github_ci
action: delete
tagSource: manual
tag: canary
- task: GitHubRelease@0
condition: and(eq(variables._IS_BUILD_CANARY, 'true'), not(contains(variables._BUILD_BRANCH, 'refs/pull/')), succeeded())
displayName: 'Create $(_RELEASE_NAME) Release (Canary)'
inputs:
gitHubConnection: github_ci
assets: $(Build.Repository.LocalPath)\catalogs\*.xml
isPreRelease: true
tagSource: manual
tag: canary
title: $(_RELEASE_NAME)-$(_RELEASE_VERSION)
releaseNotesSource: input
releaseNotes: |
This is a canary build. Please be aware it may be prone to crashing and is NOT tested by anyone. Use this build AT YOUR OWN RISK!
- task: GitHubRelease@0
condition: and(eq(variables._IS_BUILD_CANARY, 'false'), not(contains(variables._BUILD_BRANCH, 'refs/pull/')), succeeded())
displayName: 'Create $(_RELEASE_NAME) Release (Stable)'
inputs:
gitHubConnection: github_ci
assets: $(Build.Repository.LocalPath)\catalogs\*.xml
title: $(_RELEASE_NAME)-$(_RELEASE_VERSION)
15 changes: 15 additions & 0 deletions .ci/prepare.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if ($env:_BUILD_BRANCH -eq "refs/heads/master" -Or $env:_BUILD_BRANCH -eq "refs/tags/canary") {
$env:_IS_BUILD_CANARY = "true"
}
elseif ($env:_BUILD_BRANCH -like "refs/tags/*") {
$env:_BUILD_VERSION = $env:_BUILD_VERSION.Substring(0, $env:_BUILD_VERSION.LastIndexOf('.')) + ".0"
}
$env:_RELEASE_VERSION = "v${env:_BUILD_VERSION}"

Write-Output "--------------------------------------------------"
Write-Output "RELEASE VERSION: $env:_RELEASE_VERSION"
Write-Output "--------------------------------------------------"

Write-Host "##vso[task.setvariable variable=_BUILD_VERSION;]${env:_BUILD_VERSION}"
Write-Host "##vso[task.setvariable variable=_RELEASE_VERSION;]${env:_RELEASE_VERSION}"
Write-Host "##vso[task.setvariable variable=_IS_BUILD_CANARY;]${env:_IS_BUILD_CANARY}"

0 comments on commit 3e2a106

Please sign in to comment.