Skip to content

Update with review feedback #25

Update with review feedback

Update with review feedback #25

Workflow file for this run

# This workflow should be triggered when a release is done (workflow_call)
# And also need to be able to run manually (workflow_dispatch). It uses
# the current version from poetry as a tag for the docker container and
# pushes the container to the GitHub Container Registry
# (ghcr.io/deltares/d-ecoimpact:latest).
name: "Publish to GHCR"
on:
workflow_call:
inputs:
project_version:
required: true
default: false
type: string
workflow_dispatch:
push:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
# Convert Deltares/D-EcoImpact to deltares/d-ecoimpact because
# image name can't support uppercase
- name: downcase REPO
run: |
echo "IMAGE_NAME=${IMAGE_NAME,,}" >>${GITHUB_ENV}
- name: checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.VERSION_DECOIMPACT || github.token }}
fetch-depth: 0
- name: install python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.4.2
- name: Get current version
id: get-version
if: ${{ env.PROJECT_VERSION }} == false
run: |
PROJECT_VERSION=$(poetry version --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.project_version || steps.get-version.outputs.PROJECT_VERSION }}