blessing-skin-server/azure-pipelines.yml
2019-07-05 18:04:30 +08:00

97 lines
2.4 KiB
YAML

trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
RELEASE_TAG: '4.3.1'
steps:
- script: |
(git log -1 --pretty="%s" | grep -P 'Bump version to \d+\.\d+\.\d+') > /dev/null 2>&1
if [ $? -eq 0 ]
then
sudo update-alternatives --set php /usr/bin/php7.3
php -version
fi
displayName: 'Use PHP version 7.3'
- script: |
(git log -1 --pretty="%s" | grep -P 'Bump version to \d+\.\d+\.\d+') > /dev/null 2>&1
if [ $? -eq 0 ]
then
composer install --no-interaction --prefer-dist --no-dev
rm -rf vendor/bin
fi
displayName: 'composer install'
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
(git log -1 --pretty="%s" | grep -P 'Bump version to \d+\.\d+\.\d+') > /dev/null 2>&1
if [ $? -eq 0 ]
then
yarn
yarn build
fi
displayName: 'Build front end'
- script: |
(git log -1 --pretty="%s" | grep -P 'Bump version to \d+\.\d+\.\d+') > /dev/null 2>&1
if [ $? -eq 0 ]
then
composer install --no-interaction --prefer-dist --no-dev
rm -rf vendor/bin
fi
displayName: 'Archive files'
- script: |
(git log -1 --pretty="%s" | grep -P 'Bump version to \d+\.\d+\.\d+') > /dev/null 2>&1
if [ $? -eq 0 ]
then
zip -9 -r blessing-skin-server-$RELEASE_TAG.zip \
app \
bootstrap \
config \
database \
plugins \
public \
resources/lang \
resources/views \
resources/misc \
routes \
storage \
vendor \
.env.example \
artisan \
LICENSE \
README.md \
README_EN.md
mkdir dist
cd dist
cp ../blessing-skin-server-$RELEASE_TAG.zip blessing-skin-server-$RELEASE_TAG.zip
cd ..
fi
displayName: 'Create update source info'
- script: |
(cat resources/misc/changelogs/zh_CN/$RELEASE_TAG.md && echo "\n---\n" && cat resources/misc/changelogs/en/$RELEASE_TAG.md) > changelog.md
displayName: 'Generate changelog'
- task: GitHubRelease@0
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: g-plane
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'auto'
releaseNotesSource: 'file'
releaseNotesFile: 'changelog.md'
assets: 'dist/blessing-skin-server-$(RELEASE_TAG).zip'
addChangeLog: false