Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Bugfixes in Blueberry UI deployment pipeline #5

Bugfixes in Blueberry UI deployment pipeline

Bugfixes in Blueberry UI deployment pipeline #5

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# TODO this workflow should be extended to deploy separate apps for the new UI.
# The current workflow is only for the blueberry UI. Then we should also adapt
# the other pipeline to only update the images.
name: Build and deploy Node.js app to Azure Web App - ui-blueberry
on:
push:
branches:
- feature/deployment-blueberry-ui
jobs:
# get version info from existing tags
version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get latest tag
id: get-tag
# TODO the first line to get the latest tag doesnt work yet
# maybe: git tag | sort --version-sort | tail -n 1
run: |
TAG=$(git tag | sort --version-sort | tail -n 1)
echo $TAG
VERSION=${TAG#version/*}
echo $VERSION
PARTS=(${VERSION//\./ })
MAJOR=${PARTS[0]}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
PARTS2=( $(grep -Eo '[[:digit:]]+|[^[:digit:]]+' <<< ${PARTS[2]} ) )
echo "stage=${PARTS2[1]}" >> $GITHUB_OUTPUT
MAJOR_NAME=''
if [[ $MAJOR == '4' ]]; then MAJOR_NAME="cotopaxi"; fi
if [[ $MAJOR == '3' ]]; then MAJOR_NAME="petronas"; fi
echo "major_name=${MAJOR_NAME}" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.get-tag.outputs.version }}
stage: ${{ steps.get-tag.outputs.stage }}
major_name: ${{ steps.get-tag.outputs.major_name }}
# Build artifact for deployment
build:
name: Build deployment artifact
runs-on: ubuntu-latest
needs: version
env:
version: ${{ needs.version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Update UI version in package.json
run: |
npm version --no-git-tag-version --allow-same-version $version
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
# npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: node-app
path: release.zip
# Deploy to Azure
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: "Production"
url: ${{ steps.deploy-to-webapp-blueberry.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: node-app
- name: unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp-blueberry
uses: azure/webapps-deploy@v2
with:
app-name: 'ui-blueberry'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_34D7566DA42C414A95D1BEA2A214384C }}
package: ./dist/vantage6-UI