Skip to content

Merge pull request #46 from alanbchristie/master #14

Merge pull request #46 from alanbchristie/master

Merge pull request #46 from alanbchristie/master #14

Workflow file for this run

---
name: Build Latest
# Actions that take place after every commit the master/main branch.
# Here every commit is built, tagged as 'latest' and tested.
# If a DOCKERHUB_USERNAME secret is defined the image is pushed.
#
# Actions also run if the repository is tagged.
# Every tag is pushed, along with latest.
#
# Actions also run on a schedule - the the container is built, tested
# and pushed (if the relevant secrets are set) based on
# a defined schedule.
# ---------------
# Control secrets
# ---------------
#
# At the GitHub 'organisation' or 'project' level you are expected to
# have the following GitHub 'Repository Secrets' defined
# (i.e. via 'Settings -> Secrets'): -
#
# DOCKERHUB_USERNAME optional
# DOCKERHUB_TOKEN optional - required if DOCKERHUB_USERNAME
#
# -----------
# Environment (GitHub Environments)
# -----------
#
# Environment (none)
on:
push:
branches:
- 'master'
- 'main'
tags:
- '**'
schedule:
# Build every Sunday (0) at 4:45pm
- cron: '45 16 * * 0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Initialise workflow variables
id: vars
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
# Do we push, i.e. is DOCKERHUB_USERNAME defined?
echo set-output name=push::${{ env.DOCKERHUB_USERNAME != '' }}
echo ::set-output name=push::${{ env.DOCKERHUB_USERNAME != '' }}
# What image tag are we using? 'latest' (if not tagged) or a GitHub tag?
TAG="latest"
if [[ "${{ github.ref }}" =~ ^refs/tags/ ]]; then TAG="${{ env.GITHUB_REF_SLUG }}"; fi
echo set-output name=tag::${TAG}
echo ::set-output name=tag::${TAG}
- name: Checkout
uses: actions/checkout@v3
- name: Build
uses: docker/build-push-action@v4
with:
tags: xchem/fragalysis:${{ steps.vars.outputs.tag }}
- name: Test
run: >
docker run xchem/fragalysis:${{ steps.vars.outputs.tag }}
/bin/sh -c "cd /usr/local/fragalysis && nosetests"