Skip to content

Merge pull request #1089 from hmcts/djporta-patch-1 #2204

Merge pull request #1089 from hmcts/djporta-patch-1

Merge pull request #1089 from hmcts/djporta-patch-1 #2204

Workflow file for this run

on:
pull_request:
branches:
- main
push:
branches:
- main
name: Build and Publish images
jobs:
build-and-publish:
strategy:
matrix:
script: [ 'housekeeping', 'ams-reporting']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate build ID
id: prep
run: |
sha=${GITHUB_SHA::8}
ts=$(date +%s)
echo "::set-output name=BUILD_ID::${sha}-${ts}"
- name: 'Docker Login'
uses: azure/docker-login@v2
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/libragob/${{matrix.script}}:pr-${{github.event.number}}-${{ steps.prep.outputs.BUILD_ID }} --build-arg="SCRIPT_FILE=${{matrix.script}}.sh"
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/libragob/${{matrix.script}}:pr-${{github.event.number}}-${{ steps.prep.outputs.BUILD_ID }}
if: startsWith(github.ref, 'refs/pull')
name: 'Build and publish ${{matrix.script}} image'
- run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/libragob/${{matrix.script}}:prod-${{ steps.prep.outputs.BUILD_ID }} --build-arg="SCRIPT_FILE=${{matrix.script}}.sh"
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/libragob/${{matrix.script}}:prod-${{ steps.prep.outputs.BUILD_ID }}
if: github.ref == 'refs/heads/main'
name: 'Build and publish ${{matrix.script}} image'