Skip to content

Update packages.json #9446

Update packages.json

Update packages.json #9446

name: Cloud platform deployment
on:
workflow_dispatch:
push:
paths:
- 'backend/**'
branches:
- 'vcst-*'
jobs:
gitops:
runs-on: ubuntu-latest
env:
DOCKER_LOGIN: vcst-token
DOCKER_PASSWORD: ${{ secrets.VCST_ACR_DOCKER_PASSWORD }}
DOCKERFILE_PATH: ./backend
CONTAINER_REGISTRY: virtopaasregistrymain.azurecr.io
IMAGE_REPOSITORY: virtopaasregistrymain.azurecr.io/vcst/platform
PLATFORM_IMAGE_NAME: vcst-platform
ARGO_APP_NAME: ${{ github.ref_name }}
PLATFORM_IMAGE: ''
PLATFORM_TAG: ''
steps:
- uses: actions/checkout@v4
- name: Install vc-build
run: |
dotnet tool install --global VirtoCommerce.GlobalTool
- name: Pack
shell: bash {0}
run: |
vc-build InstallModules -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_IMAGE=$(cat ./backend/packages.json | jq -r '.PlatformImage')" >> $GITHUB_ENV
echo "PLATFORM_TAG=$(cat ./backend/packages.json | jq -r '.PlatformImageTag')" >> $GITHUB_ENV
- name: Set outputs
id: vars
run: echo "paas_tag=${{ env.PLATFORM_TAG }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build platform Image
run: |
docker build --build-arg PLATFORM_IMAGE=${{ env.PLATFORM_IMAGE }} --build-arg PLATFORM_TAG=${{ env.PLATFORM_TAG }} -t ${{env.PLATFORM_IMAGE_NAME}} ${{env.DOCKERFILE_PATH}}
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ env.DOCKER_LOGIN }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Publish platform image to the Virto Cloud
run: |
docker tag ${{env.PLATFORM_IMAGE_NAME}} ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG }}
docker push ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG }}
env:
TAG: ${{ steps.vars.outputs.paas_tag }}
- name: Az config
run: |
az config set extension.use_dynamic_install=yes_without_prompt
- name: Update app
run: |
vc-build CloudEnvSetParameter -EnvironmentName ${{ env.ARGO_APP_NAME }} -CloudToken ${{ secrets.VCST_PLATFORM_TOKEN }} -HelmParameters platform.image.tag=$TAG
env:
TAG: ${{ steps.vars.outputs.paas_tag }}