Skip to content

Create containers #1273

Create containers

Create containers #1273

Workflow file for this run

name: Create containers
on:
# run every night
schedule:
- cron: "0 22 * * *"
# schedule manually
workflow_dispatch:
inputs:
# On workflow dispatch, `branch` is selected by default
# You can access it in `github.ref_name`
tag_name:
description: "Tag name for the container"
required: true
default: "nightly"
container_repository_branch:
description: "Branch of the container repository"
required: true
default: "main"
jobs:
create-container:
if: github.event_name != 'schedule' || github.repository_owner == 'geo-engine'
strategy:
matrix:
app:
- {project: gis}
- {project: gfbio}
- {project: data-atlas}
- {project: nfdi-portal-demo}
- {project: ebv-analyzer}
- {project: ecometrics}
- {project: esg-indicator-service}
- {project: manager, angular_base_href: "/manager/"}
runs-on: ubuntu-24.04
env:
TAG_NAME: nightly
FULL_TAG_NAME: nightly
CONTAINER_REPOSITORY_BRANCH: main
BUILD_TAG: gis
ANGULAR_BASE_HREF:
steps:
- name: Modify TAG_NAME if on `tag_name` is set on `workflow_dispatch`
if: github.event.inputs.tag_name != ''
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- name: Modify CONTAINER_REPOSITORY_BRANCH if on `container_repository_branch` is set on `workflow_dispatch`
if: github.event.inputs.container_repository_branch != ''
run: |
echo "CONTAINER_REPOSITORY_BRANCH=${{ github.event.inputs.container_repository_branch }}" >> $GITHUB_ENV
- name: Set `FULL_TAG_NAME` wrt. apps
run: |
echo "FULL_TAG_NAME=${{matrix.app.project}}-${{env.TAG_NAME}}" >> $GITHUB_ENV
echo "BUILD_TAG=${{matrix.app.project}}" >> $GITHUB_ENV
- name: Modify `BUILD_TAG` if dashboard
if: env.BUILD_TAG != 'gis' && env.BUILD_TAG != 'manager'
run: echo "BUILD_TAG=dashboards/${{env.BUILD_TAG}}" >> $GITHUB_ENV
- name: Set additional params
if: matrix.app.angular_base_href
run: echo "ANGULAR_BASE_HREF=${{matrix.app.angular_base_href}}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
path: geoengine-ui
- name: Checkout container files
uses: actions/checkout@v4
with:
repository: geo-engine/geoengine-container
ref: ${{ env.CONTAINER_REPOSITORY_BRANCH }}
ssh-key: ${{ secrets.CONTAINER_GITHUB_TOKEN }}
path: "container"
- name: Login to quay.io
run: podman login -u="geoengine+bot" -p="${{secrets.QUAY_IO_TOKEN}}" quay.io
- name: Build with podman
run: |
podman build \
--tag "geoengine-ui:${{env.FULL_TAG_NAME}}" \
--build-arg GEOENGINE_UI_PROJECT="${{env.BUILD_TAG}}" \
--build-arg GEOENGINE_UI_ANGULAR_BASE_HREF="${{env.ANGULAR_BASE_HREF}}" \
-f container/geoengine-ui/Dockerfile \
.
- name: Push image to quay.io
run: podman push geoengine-ui:${{env.FULL_TAG_NAME}} quay.io/geoengine/geoengine-ui:${{env.FULL_TAG_NAME}}
- name: Push nightly with date
if: env.TAG_NAME == 'nightly'
run: podman push geoengine-ui:${{env.FULL_TAG_NAME}} quay.io/geoengine/geoengine-ui:${{env.FULL_TAG_NAME}}-$(date +'%Y-%m-%d')
notify-slack-on-failure:
name: Post to a Slack channel in case of failure
needs: create-container
if: always()
runs-on: ubuntu-24.04
steps:
- name: Post to a Slack channel
if: ${{ needs.create-container.result == 'failure' }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: "geoengine-dev-core"
slack-message: "⚠️ The workflow ${{ github.workflow }} in the repository ${{ github.event.repository.name }} FAILED!"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}