Create containers #409
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: 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: | |
app: ["gis", "gfbio", "data-atlas", "nfdi-portal-demo", "ebv-analyzer"] | |
runs-on: ubuntu-22.04 | |
env: | |
TAG_NAME: nightly | |
FULL_TAG_NAME: nightly | |
BUILD_TAG: gis | |
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: Set `FULL_TAG_NAME` wrt. apps | |
run: | | |
echo "FULL_TAG_NAME=${{matrix.app}}-${{env.TAG_NAME}}" >> $GITHUB_ENV | |
echo "BUILD_TAG=${{matrix.app}}" >> $GITHUB_ENV | |
- name: Modify `BUILD_TAG` if dashboard | |
if: env.BUILD_TAG != 'gis' | |
run: echo "BUILD_TAG=dashboards/${{env.BUILD_TAG}}" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
path: geoengine-ui | |
- 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-ui:${{env.FULL_TAG_NAME}}" \ | |
--build-arg GEOENGINE_UI_PROJECT="${{env.BUILD_TAG}}" \ | |
-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') |