Skip to content

chore: trigger the ESS deployment pipeline only for staging branch (#… #378

chore: trigger the ESS deployment pipeline only for staging branch (#…

chore: trigger the ESS deployment pipeline only for staging branch (#… #378

Workflow file for this run

name: Build && Push
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the develop branch
on:
push:
branches:
- develop
- staging
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: extract_branch
uses: swapActions/get-branch-name@v1
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
build-args: BUILD_VERSION=${{ github.sha }}
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ghcr.io/userofficeproject/user-office-factory:${{ steps.extract_branch.outputs.branch }}
cache-from: |
type=gha,scope=${{ github.workflow }}:linux/amd64
type=gha,scope=${{ github.workflow }}:linux/arm64/v8
- name: Trigger pipeline
if: ${{ steps.extract_branch.outputs.branch == 'staging' }} # Only trigger pipeline for staging branch
uses: swapActions/trigger-useroffice-deployment@v1
with:
repository: ${{ github.repository }}
environment: ${{ steps.extract_branch.outputs.branch }}
gh-trigger-url: ${{ secrets.GITLAB_TRIGGER_URL }}
gh-token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
- name: Trigger Jenkins
run: |
curl -k -l -u ${{ secrets.STFC_CI_TRIGGER_USERNAME }}:${{ secrets.STFC_CI_TRIGGER_TOKEN }} "${{ secrets.STFC_CI_TRIGGER_BASE_URL }}/Dev_Deploy_ProposalFactory.LatestImage/build?token=${{ secrets.STFC_CI_TRIGGER_URL_TOKEN }}"