Skip to content

Merge pull request #18 from ESA-EarthCODE/news #12

Merge pull request #18 from ESA-EarthCODE/news

Merge pull request #18 from ESA-EarthCODE/news #12

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
# Copies the main branch to the root of the deployment, and the staging branch into the /staging/ subfolder
name: Deploy
on:
# Runs on pushes targeting the default branch and tags
push:
branches: ["main"]
tags:
- '*'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
packages: write
env:
IMAGE_NAME: portal
jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Checkout staging
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Login ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: 'Push ghcr'
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[[ "$VERSION" == "main" ]] && VERSION="dev-${{ github.run_number }}"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION