On-demand ingest build #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Embargo Butler ingest container on demand | |
on: | |
workflow_dispatch: | |
inputs: | |
rubinenvVersion: | |
description: 'rubin-env version' | |
required: true | |
default: '7.0.1' | |
obsLsstVersion: | |
description: 'Science Pipelines release' | |
required: true | |
default: 'w_2023_41' | |
env: | |
INGEST_NAME: embargo-butler-ingest | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build ingest image | |
run: | | |
docker build . \ | |
-f Dockerfile.ingest \ | |
--tag $INGEST_NAME \ | |
--label "runnumber=${GITHUB_RUN_ID}" \ | |
--build-arg "RUBINENV_VERSION=${{ inputs.rubinenvVersion }}" \ | |
--build-arg "OBS_LSST_VERSION=${{ inputs.obsLsstVersion }}" | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push image | |
run: | | |
INGEST_ID=ghcr.io/${{ github.repository_owner }}/$INGEST_NAME | |
if [[ "${{ github.ref }}" == "refs/pull/"* ]]; then | |
VERSION=$(echo "${{ github.head_ref }}" | sed -e 's|.*/||') | |
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then | |
VERSION=$(echo "${{ github.ref_name }}" | sed -e 's|^v||') | |
else | |
VERSION=latest | |
fi | |
INGEST_VERSION="${VERSION}-${{ inputs.obsLsstVersion }}" | |
echo INGEST_ID=$INGEST_ID | |
echo VERSION=$VERSION | |
echo INGEST_VERSION=$INGEST_VERSION | |
docker tag $INGEST_NAME $INGEST_ID:$INGEST_VERSION | |
docker push $INGEST_ID:$INGEST_VERSION |