orchard/azure-pipelines.yml
2023-05-10 20:58:55 +03:00

150 lines
4.5 KiB
YAML

# Cider-1 Azure Pipeline Workflow
# Maintained by Cider Devops.
# Don't make changes unless you know what you're doing.
trigger:
branches:
include:
- main
paths:
include:
- src/**/*
- azure-pipelines.yml
variables:
COMMIT_URL: "$(Build.Repository.Uri)/commit/$(Build.SourceVersion)"
BUILD_URL: "$(System.CollectionUri)/$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn/cache
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jobs:
# Linux Production Build Test
# This job is used to test the production build of the Linux distribution.
# Also tests Pull Requests.
- job: compile_linux
displayName: "Compile Linux Distribution"
pool: Linux
steps:
- task: NodeTool@0
displayName: "Install Node.js"
inputs:
versionSource: "fromFile"
versionFilePath: ".nvmrc"
# - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
# - task: Cache@2
# inputs:
# key: 'yarn | "$(Agent.OS)" | yarn.lock'
# path: $(YARN_CACHE_FOLDER)
# displayName: Cache yarn
- script: |
yarn set version from sources
displayName: "Setup yarn"
# Install dependencies (immutable for non-PR builds)
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- script: yarn dist:linux
env: {GH_TOKEN : $(GH_TOKEN)}
displayName: "Compile Distribution"
- task: CopyFiles@2
displayName: "Copy to artifacts staging directory"
inputs:
SourceFolder: "dist"
Contents: "*.AppImage"
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Upload Artifacts
inputs:
ArtifactName: "Cider-2"
publishLocation: "Container"
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
# Windows Production Build Test
# This job is used to test the production build of the Windows distribution.
# Also tests Pull Requests.
- job: compile_windows
displayName: "Compile Windows Distribution"
pool: Linux
steps:
- task: NodeTool@0
displayName: "Install Node.js"
inputs:
versionSource: "fromFile"
versionFilePath: ".nvmrc"
# - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
# - task: Cache@2
# inputs:
# key: 'yarn | "$(Agent.OS)" | yarn.lock'
# path: $(YARN_CACHE_FOLDER)
# displayName: Cache yarn
- script: |
yarn set version from sources
displayName: "Setup yarn"
# Install dependencies (immutable for non-PR builds)
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- script: yarn install
displayName: "Install Dependencies"
- script: yarn dist:win
env: {GH_TOKEN : $(GH_TOKEN)}
displayName: "Compile Distribution"
- task: CopyFiles@2
displayName: "Copy to artifacts staging directory"
inputs:
SourceFolder: "dist"
Contents: "*.exe"
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Upload Artifacts
inputs:
ArtifactName: "Cider-2"
publishLocation: "Container"
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
- job: upload_files
dependsOn:
- compile_linux
- compile_windows
pool: Linux
steps:
- task: GitHubRelease@1
inputs:
gitHubConnection: 'AzurePipelines'
repositoryName: 'ciderapp/cider-releases'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: 'v1.6.1-citest'
title: 'Cider Version 1.6.1 (CI test)'
releaseNotesFilePath: 'Test build from azure CI'
isPreRelease: true
changeLogCompareToRelease: 'lastNonDraftRelease'
changeLogType: 'commitBased'