Skip to content

Adapted template

Adapted template #2

name: Cloud platform deployment
on:
workflow_dispatch:
push:
paths:
- 'backend/**'
branches: [ main ]
jobs:
gitops:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Az config
run: |
az config set extension.use_dynamic_install=yes_without_prompt
- name: Install vc-build
run: |
dotnet tool install --global VirtoCommerce.GlobalTool
- name: Pack
run: |
vc-build install -PackageManifestPath ./backend/packages.json -ProbingPath ./backend/platform/app_data/modules -DiscoveryPath ./backend/platform/modules --root ./backend/platform -SkipDependencySolving
- name: Get platfrom version
id: platform-version
run: |
echo "PLATFORM_VERSION=$(cat ./backend/packages.json | jq -r '.PlatformVersion')" >> $GITHUB_ENV
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and Publish Docker Image to Virto container registry
run: |
vc-build BuildAndPush -DockerUsername $DOCKER_LOGIN -DockerPassword $DOCKER_PASSWORD -DockerfilePath $DOCKERFILE_PATH -DockerImageName $IMAGE_REPOSITORY -DockerImageTag $TAG -DockerRegistryUrl $CONTAINER_REGISTRY
env:
DOCKER_LOGIN: virtostart
DOCKER_PASSWORD: ${{ secrets.VIRTOSTART_ACR_DOCKER_PASSWORD }}
DOCKERFILE_PATH: ./backend/Dockerfile
CONTAINER_REGISTRY: virtopaasregistrymain.azurecr.io
IMAGE_REPOSITORY: virtopaasregistrymain.azurecr.io/virtostart/platform
TAG: ${{ env.PLATFORM_VERSION }}-${{ steps.vars.outputs.sha_short }}
- name: Update app
run: |
vc-build CloudEnvSetParameter -EnvironmentName virtostart-test -CloudToken ${{ secrets.VIRTOSTART_PLATFORM_TOKEN }} -HelmParameters platform.image.tag=$TAG
env:
TAG: ${{ env.PLATFORM_VERSION }}-${{ steps.vars.outputs.sha_short }}