Skip to content

Merge pull request #63 from neherlab/fix/issue-62 #123

Merge pull request #63 from neherlab/fix/issue-62

Merge pull request #63 from neherlab/fix/issue-62 #123

Workflow file for this run

name: Build
on:
push:
tags:
- '*'
branches:
- 'master'
pull_request:
branches:
- '*'
repository_dispatch:
types: build
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
Docker-Build-and-Push:
name: 'Docker build'
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '1'
- name: 'Get branch names'
id: branch-name
uses: tj-actions/branch-names@v6
- name: 'Build Docker image'
run: |
set -euxo pipefail
if [ ${{ github.ref_type }} == 'tag' ]; then
export GIT_TAG="${{ github.ref_name }}"
else
export GIT_BRANCH="${{ steps.branch-name.outputs.current_branch }}"
export GIT_BRANCH="${GIT_BRANCH//\//-}"
fi
make docker
- name: 'Run tests'
run: |
set -euxo pipefail
make docker-test
- name: 'Login to DockerHub'
if: github.ref_type == 'tag' || steps.branch-name.outputs.is_default == 'true'
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: 'Push Docker image'
if: github.ref_type == 'tag' || steps.branch-name.outputs.is_default == 'true'
run: |
set -euxo pipefail
if [ ${{ github.ref_type }} == 'tag' ]; then
export GIT_TAG="${{ github.ref_name }}"
else
export GIT_BRANCH="${{ steps.branch-name.outputs.current_branch }}"
export GIT_BRANCH="${GIT_BRANCH//\//-}"
fi
make docker-push