Skip to content

Merge pull request #2097 from solliancenet/mg-trigger-on-release-branch #1015

Merge pull request #2097 from solliancenet/mg-trigger-on-release-branch

Merge pull request #2097 from solliancenet/mg-trigger-on-release-branch #1015

Workflow file for this run

name: Pre-release Build
on:
push:
branches:
- release/**
workflow_dispatch:
inputs: {}
jobs:
generate_matrix:
runs-on: ubuntu-latest
outputs:
registry: ${{ steps.set-registry.outputs.result }}
service_matrix: ${{ steps.set-service-matrix.outputs.result }}
test_matrix: ${{ steps.set-test-matrix.outputs.result }}
docker_tag: ${{ steps.docker-tag.outputs.docker_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Service Matrix
uses: actions/github-script@v7
id: set-service-matrix
with:
result-encoding: string
script: |
const fs = require('fs')
const jsonString = fs.readFileSync('./tests/config/e2e-test-manifest.json')
var data = JSON.parse(jsonString)
return JSON.stringify(data.service_matrix)
- name: Set Test Matrix
uses: actions/github-script@v7
id: set-test-matrix
with:
result-encoding: string
script: |
const fs = require('fs')
const jsonString = fs.readFileSync('./tests/config/e2e-test-manifest.json')
var data = JSON.parse(jsonString)
return JSON.stringify(data.test_matrix)
- name: Set Container registry
uses: actions/github-script@v7
id: set-registry
with:
result-encoding: string
script: |
const fs = require('fs')
const jsonString = fs.readFileSync('./tests/config/sandbox-registry.json')
var data = JSON.parse(jsonString)
return data.registry
- name: Set Git and Helm Tag
id: docker-tag
run: |
DOCKER_TAG=$(echo ${{ github.ref_name }} | cut -d'/' -f 2)
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
echo "docker_tag: Latest Tag is : $DOCKER_TAG"
echo "docker_tag=$DOCKER_TAG" >> $GITHUB_OUTPUT
helm_build:
name: Package Helm Charts
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/poc/')
needs: generate_matrix
strategy:
fail-fast: false
matrix:
object: ${{ fromJson(needs.generate_matrix.outputs.service_matrix) }}
uses: ./.github/workflows/build-helm-chart.yml
with:
chart: ${{ matrix.object.name }}
registry: ${{ needs.generate_matrix.outputs.registry }}
tag: ${{ needs.generate_matrix.outputs.docker_tag }}
username: e2e-token
target: sandbox
secrets: inherit
docker_build:
name: Build Docker Images
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/poc/')
needs: generate_matrix
strategy:
fail-fast: false
matrix:
object: ${{ fromJson(needs.generate_matrix.outputs.service_matrix) }}
uses: ./.github/workflows/build-docker-image.yml
with:
image: ${{ matrix.object.name }}
context: ${{ matrix.object.context }}
dockerfile: ${{ matrix.object.dockerfile }}
registry: ${{ needs.generate_matrix.outputs.registry }}
tag: ${{ needs.generate_matrix.outputs.docker_tag }}
username: e2e-token
target: sandbox
secrets: inherit