Skip to content

Merge pull request #1130 from votca/fix_Ci #2901

Merge pull request #1130 from votca/fix_Ci

Merge pull request #1130 from votca/fix_Ci #2901

Workflow file for this run

name: Docker
on:
push:
branches:
- master
tags:
- v[0-9]*
pull_request:
branches:
- master
schedule:
- cron: '0 5 * * FRI'
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: votca
- name: Determine tag
id: tag
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
TAG=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
[[ ${TAG} = master ]] && TAG="latest"
elif [[ $GITHUB_REF == refs/pull/* ]]; then
TAG=pr-${{ github.event.number }}
fi
echo "Docker tag is ${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Container Registry
if: github.repository_owner == 'votca' && ( github.event_name == 'push' || github.event_name == 'schedule' )
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to Github Container Registry
if: github.repository_owner == 'votca' && ( github.event_name == 'push' || github.event_name == 'schedule' )
uses: docker/login-action@v2
with:
registry: ghcr.io
# username do not matter, but needs to be a secret, so it gets nulled out on PR from forks
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.VOTCA_BOT_TOKEN }}
- name: Login to Gitlab Container Registry
if: github.repository_owner == 'votca' && ( github.event_name == 'push' || github.event_name == 'schedule' )
uses: docker/login-action@v2
with:
registry: registry.gitlab.com
username: ${{ secrets.GITLAB_REGISTRY_USERNAME }}
password: ${{ secrets.GITLAB_REGISTRY_TOKEN }}
- name: Build and Push Docker images for all Container Registries
uses: docker/build-push-action@v3
with:
tags: |
votca/votca:${{ steps.tag.outputs.tag }}
ghcr.io/votca/votca:${{ steps.tag.outputs.tag }}
registry.gitlab.com/votca/votca:${{ steps.tag.outputs.tag }}
file: votca/.github/workflows/Dockerfile
context: .
pull: true
push: ${{ github.repository_owner == 'votca' && ( github.event_name == 'push' || github.event_name == 'schedule' ) }}