Skip to content

Move to monorepo

Move to monorepo #24

Workflow file for this run

name: Build & Publish Docker Image
# ! Change this back to released
#on:
# release:
# types: [ published ]
on:
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build-base-js:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
strategy:
matrix:
type: [ "js-build", "js-run"]
steps:
- name: Set Service Name
run: echo "TYPE=${{ matrix.type }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/prepare
id: prepare
with:
service-name: acs-base
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build JS Build Base
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./acs-base-images/Dockerfile.${{ env.TYPE }}
push: true
tags: ghcr.io/amrc-factoryplus/${{ steps.prepare.outputs.service-name }}-${{ env.TYPE }}:${{ steps.prepare.outputs.version }}
build-args: |
base=ghcr.io/amrc-factoryplus/${{ steps.prepare.outputs.service-name }}
version=${{ steps.prepare.outputs.version }}
labels: ${{ steps.prepare.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ./.github/actions/cleanup
id: cleanup
with:
version: ${{ steps.prepare.outputs.version }}
service-name: ${{ steps.prepare.outputs.service-name }}-${{ env.TYPE }}
digest: ${{ steps.build-and-push.outputs.digest }}
build-base-pg:
runs-on: ubuntu-latest
needs: build-base-js
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
strategy:
matrix:
type: [ "pg-build", "pg-run" ]
steps:
- name: Set Service Name
run: echo "TYPE=${{ matrix.type }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/prepare
id: prepare
with:
service-name: acs-base
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build JS Build Base
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./acs-base-images/Dockerfile.${{ env.TYPE }}
push: true
tags: ghcr.io/amrc-factoryplus/${{ steps.prepare.outputs.service-name }}-${{ env.TYPE }}:${{ steps.prepare.outputs.version }}
build-args: |
base=ghcr.io/amrc-factoryplus/${{ steps.prepare.outputs.service-name }}
version=${{ steps.prepare.outputs.version }}
labels: ${{ steps.prepare.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ./.github/actions/cleanup
id: cleanup
with:
version: ${{ steps.prepare.outputs.version }}
service-name: ${{ steps.prepare.outputs.service-name }}-${{ env.TYPE }}
digest: ${{ steps.build-and-push.outputs.digest }}
build:
needs: [build-base-js, build-base-pg]
runs-on: ubuntu-latest
strategy:
matrix:
service: [ "acs-auth", "acs-directory" ]
permissions:
contents: read
packages: write
id-token: write
pull-requests: write
steps:
- name: Set Service Name
run: echo "SERVICE_NAME=${{ matrix.service }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/prepare
id: prepare
with:
service-name: ${{ env.SERVICE_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v5
id: build-and-push
with:
context: ./${{ steps.prepare.outputs.service-name }}
push: true
tags: ghcr.io/amrc-factoryplus/${{ steps.prepare.outputs.service-name }}:${{ steps.prepare.outputs.version }}
labels: ${{ steps.prepare.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ./.github/actions/cleanup
id: cleanup
with:
version: ${{ steps.prepare.outputs.version }}
service-name: ${{ steps.prepare.outputs.service-name }}
digest: ${{ steps.build-and-push.outputs.digest }}