-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines-docs.yml
88 lines (82 loc) · 2.61 KB
/
azure-pipelines-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# @format
# Azure Pipelines -- Generate project documentation
# @description: Generates documentation based on code in project, then commits changes to PR/branch. Uses variables to set git user for commits.
# Git User:$(CI_GIT_USER)
# Git Email:$(CI_GIT_EMAIL)
# make sure you update the include branch to match your project structure
# updates docs on main branch after pull request is completed and changes are merged
# https://aka.ms/yaml
#azure-pipelines-docs.yml
variables:
- group: NPM-PKG-Token
- group: project-versions
- name: CI_GIT_USER
value: CHANGE ME NAME
- name: CI_GIT_EMAIL
value: [email protected]
- name: CI_BRANCH
value: main
trigger:
branches:
include:
- main
pr: none
pool:
vmImage: ubuntu-latest
jobs:
- job: update_docs
displayName: Update Docs
condition: eq(variables.NetSuite_updateDocs, 'true')
steps:
- checkout: self
clean: true
persistCredentials: true
- script: |
git config user.email "$(CI_GIT_EMAIL)" & git config user.name "$(CI_GIT_NAME)"
git checkout -b "$(CI_BRANCH)"
- task: Npm@1
inputs:
command: 'install'
- script: |
npm run docs
git add -A
git commit -m "📝 Updating Docs [ci skip]"
git push --set-upstream origin "$(CI_BRANCH)"
env:
NPM_TOKEN: $(NPM_TOKEN)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- job: publish_docs
displayName: Publish Docs
dependsOn: update_docs
steps:
- task: CopyFiles@2
inputs:
contents: |
**/docs/**
!**node_modules**
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: Stage Build Artifact
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'YOUR_SUBSCRIPTION_ID_HERE'
appType: 'webApp'
WebAppName: 'netsuite-docs'
deployToSlotOrASE: true
ResourceGroupName: 'netsuite-docs_group'
SlotName: 'production'
packageForLinux: '$(Build.ArtifactStagingDirectory)/docs/'
- job: mark_updated
displayName: Mark Docs Updated
dependsOn: publish_docs
steps:
- task: MorenoBruschi.manage-variable-group-task.custom-build-release-task.ManageVariableGroupTask@0
displayName: 'Azure DevOps Variable Group Management'
inputs:
pat: '$(System.AccessToken)'
project: $(PROJECT_ID)
vgname: project-versions
orgname: YOU_ORGANIZATION_NAME_HERE
op: Update
varops: |
= NetSuite_updateDocs => "false"