Skip to content

Create containers

Create containers #758

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"
jobs:
create-container:
if: github.event_name != 'schedule' || github.repository_owner == 'geo-engine'
strategy:
matrix:
cargo-features: ["pro", ""]
runs-on: ubuntu-22.04
env:
TAG_NAME: nightly
FULL_TAG_NAME: nightly
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
echo "FULL_TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- name: Set `FULL_TAG_NAME` wrt. cargo features
if: matrix.cargo-features != ''
run: |
echo "FULL_TAG_NAME=${{matrix.cargo-features}}-${{env.TAG_NAME}}" >> $GITHUB_ENV
echo "CARGO_FEATURES=--features=${{matrix.cargo-features}}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
path: geoengine
- name: Checkout container files
uses: actions/checkout@v3
with:
repository: geo-engine/geoengine-container
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:${{env.FULL_TAG_NAME}} \
--build-arg GEO_ENGINE_CARGO_BUILD_PARAMS="--release ${{env.CARGO_FEATURES}}" \
-f container/geoengine/Dockerfile \
.
- name: Push image to quay.io
run: podman push geoengine:${{env.FULL_TAG_NAME}} quay.io/geoengine/geoengine:${{env.FULL_TAG_NAME}}
- name: Push nightly with date
if: env.TAG_NAME == 'nightly'
run: podman push geoengine:${{env.FULL_TAG_NAME}} quay.io/geoengine/geoengine:${{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-22.04
steps:
- name: Post to a Slack channel
if: ${{ needs.create-container.result == 'failure' }}
id: slack
uses: slackapi/slack-github-action@v1.23.0
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 }}