You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.4 KiB
157 lines
5.4 KiB
name: ng-alain
|
|
|
|
trigger:
|
|
- master
|
|
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
pr:
|
|
autoCancel: true
|
|
branches:
|
|
exclude:
|
|
- gh-pages
|
|
|
|
stages:
|
|
- stage: Env
|
|
jobs:
|
|
- job: Nodes
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '12.14.1'
|
|
displayName: 'Install Node.js'
|
|
|
|
- stage: build
|
|
dependsOn: env
|
|
jobs:
|
|
- job: Build
|
|
steps:
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: |
|
|
node ./scripts/_ci/github-comment.js "RELEASE" "[Using release @delon, Preview Preparing...](https://dev.azure.com/ng-alain/ng-alain/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
- task: Bash@3
|
|
displayName: 'Build'
|
|
inputs:
|
|
targetType: 'filePath'
|
|
filePath: './scripts/_ci/deploy-pipelines.sh'
|
|
- script: ls -al dist/
|
|
displayName: 'List build'
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain.surge.sh
|
|
echo "Deploy to $DEPLOY_DOMAIN"
|
|
cp ./dist/index.html ./dist/404.html
|
|
npx surge --project ./dist --domain $DEPLOY_DOMAIN
|
|
displayName: 'Deploy Site'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
SURGE_LOGIN: $(SURGE_LOGIN)
|
|
SURGE_TOKEN: $(SURGE_TOKEN)
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain.surge.sh
|
|
node ./scripts/_ci/github-comment.js "RELEASE" "[Using release @delon, Preview is ready!]($DEPLOY_DOMAIN)"
|
|
displayName: 'Update comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
- job: Build_Failed
|
|
dependsOn: Build
|
|
condition: failed()
|
|
steps:
|
|
- checkout: self
|
|
displayName: 'Checkout'
|
|
clean: true
|
|
fetchDepth: 1
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: |
|
|
node ./scripts/_ci/github-comment.js "RELEASE" "[Using release @delon, Preview Failed](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
|
|
- stage: build_day
|
|
dependsOn: env
|
|
jobs:
|
|
- job: Build
|
|
steps:
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: |
|
|
node ./scripts/_ci/github-comment.js "RELEASE_DAY" "[Using day release @delon, Preview Preparing...](https://dev.azure.com/ng-alain/ng-alain/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
- task: Bash@3
|
|
displayName: 'Build'
|
|
inputs:
|
|
targetType: 'filePath'
|
|
filePath: './scripts/_ci/deploy-pipelines.sh'
|
|
arguments: '-day'
|
|
- script: ls -al dist/
|
|
displayName: 'List build'
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-day-ng-alain.surge.sh
|
|
echo "Deploy to $DEPLOY_DOMAIN"
|
|
cp ./dist/index.html ./dist/404.html
|
|
npx surge --project ./dist --domain $DEPLOY_DOMAIN
|
|
displayName: 'Deploy Site'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
SURGE_LOGIN: $(SURGE_LOGIN)
|
|
SURGE_TOKEN: $(SURGE_TOKEN)
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-day-ng-alain.surge.sh
|
|
node ./scripts/_ci/github-comment.js "RELEASE_DAY" "[Using day release @delon, Preview is ready!]($DEPLOY_DOMAIN)"
|
|
displayName: 'Update comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
- job: Build_Failed
|
|
dependsOn: Build
|
|
condition: failed()
|
|
steps:
|
|
- checkout: self
|
|
displayName: 'Checkout'
|
|
clean: true
|
|
fetchDepth: 1
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: |
|
|
node ./scripts/_ci/github-comment.js "RELEASE_DAY" "[Using day release @delon, Preview Failed](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
env:
|
|
ACCESS_REPO: $(ACCESS_REPO)
|
|
ACCESS_TOKEN: $(ACCESS_TOKEN)
|
|
|
|
- stage: lint
|
|
dependsOn:
|
|
- env
|
|
jobs:
|
|
- job: site
|
|
steps:
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: |
|
|
npx stylelint --version
|
|
yarn run lint
|
|
|
|
- stage: test
|
|
dependsOn:
|
|
- env
|
|
jobs:
|
|
- job: site
|
|
steps:
|
|
- script: yarn install
|
|
displayName: 'Install'
|
|
- script: npx ng test --no-progress --browsers=ChromeHeadlessCI --code-coverage --no-watch
|