Skip to content

Merge branch 'staging' #641

Merge branch 'staging'

Merge branch 'staging' #641

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: [E2E-tests]
types: [completed]
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Manual run'
required: false
type: boolean
jobs:
publish-on-success:
if: |
github.repository == 'scilifelabdatacentre/serve' &&
(
(github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
||
(github.event.workflow_run.conclusion == 'success')
||
(github.event_name == 'workflow_dispatch')
)
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfile
image: ghcr.io/${{ github.repository }}/serve-studio
- dockerfile: ./Dockerfile.nginx
image: ghcr.io/${{ github.repository }}/serve-ingress
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set current date as env variable
run: echo "BUILD_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Docker meta
uses: docker/metadata-action@v4
id: meta
with:
images: ${{ matrix.image }}
tags: |
type=raw,value={{date 'YYYYMMDD'}},prefix=${{ github.ref_name }}-
- name: Set the build date project toml file
uses: sandstromviktor/[email protected]
with:
file: "pyproject.toml"
key: "tool.serve.build-date"
value: ${{ env.BUILD_DATE }}
- name: Set the git tag or branch name in the project toml file
uses: sandstromviktor/[email protected]
with:
file: "pyproject.toml"
key: "tool.serve.gitref"
value: ${{ github.ref_name }}
- name: Set the image tag in the project toml file
uses: sandstromviktor/[email protected]
with:
file: "pyproject.toml"
key: "tool.serve.imagetag"
value: ${{ steps.meta.outputs.version }}
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build serve
uses: docker/build-push-action@v5
with:
context: .
build-args: DISABLE_EXTRAS=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
push: "${{ github.event_name != 'pull_request' }}"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ${{ matrix.dockerfile }}
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'Not publishing. Triggering workflow failed' && exit 1