Skip to content

Release 2023-12-08 (#962) #296

Release 2023-12-08 (#962)

Release 2023-12-08 (#962) #296

Workflow file for this run

name: Continuous Delivery (SC)
on:
workflow_dispatch:
push:
branches:
- master
- master-*
- develop
- develop-*
- build/*
jobs:
build:
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
matrix:
env:
- MANDANT: imp
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install
uses: bahmutov/npm-install@v1
- name: Get repository-name, branch-name and version-name
run: |
echo "APP=$(echo ${GITHUB_REPOSITORY##*/})" >> $GITHUB_ENV
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
echo "VERSION_NAME=$(echo $(echo ${GITHUB_REF#refs/heads/} | cut -c -52)-$(git rev-parse --short ${GITHUB_SHA}) | sed -e 's/[^a-zA-Z0-9]/-/g')" >> $GITHUB_ENV
- name: Get environment by branch
run: |
echo "ENV=$(if [[ ${{ env.BRANCH_NAME }} =~ ^master ]]; then echo "production"; else echo "test"; fi)" >> $GITHUB_ENV
- name: Checkout and sync "icmaa/shop-workspace" repo
run: |
yarn global add @icmaa/config-sync
export CONFIG_BRANCH=$(if [[ ${{ env.BRANCH_NAME }} =~ ^master ]]; then echo "-b master"; fi)
config-sync -t ${{ secrets.PAT }} -r vue-storefront $CONFIG_BRANCH -d ./
- name: Build "${{ env.APP }}"
run: yarn build
env:
NODE_CONFIG_ENV: ${{ env.ENV }}-sc
NODE_APP_INSTANCE: ${{ matrix.env.MANDANT }}
- name: Login to docker registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
file: docker/scale-commerce/Dockerfile
context: ./
tags: |
${{ github.repository }}:${{ env.ENV == 'production' && 'prod' || 'test' }}-latest
${{ github.repository }}:${{ env.ENV == 'production' && 'prod' || 'test' }}-${{ env.VERSION_NAME }}
push: true
- name: Trigger ScaleCommerce GitLab-Pipeline
run: |
curl \
--location 'https://gitlab.scale.sc/api/v4/projects/${{ secrets.SC_GITLAB_PROJECT_ID }}/trigger/pipeline' \
--form 'token="${{ secrets.SC_GITLAB_TOKEN }}"' \
--form 'variables[BRANCH]="${{ env.ENV == 'production' && 'prod' || 'test' }}"' \
--form 'ref="main"'