Merge pull request #312 from giffels/update-citation-cff #508
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Builds | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '*.*.*' | |
pull_request: | |
branches: | |
- 'master' | |
jobs: | |
setup-docker-builds: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get containers to build | |
id: get_containers | |
run: | | |
python3 -c ' | |
import json | |
import pathlib | |
print( | |
"containers=%s" | |
% json.dumps([ | |
str(path.parent.relative_to("containers")) | |
for path in pathlib.Path("containers").glob("**/Dockerfile") | |
] | |
)) | |
' >> $GITHUB_OUTPUT | |
outputs: | |
containers: ${{ steps.get_containers.outputs.containers }} | |
docker-builds: | |
needs: setup-docker-builds | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
containers: ${{ fromJSON(needs.setup-docker-builds.outputs.containers) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
tags: | | |
type=pep440,pattern={{version}} | |
type=raw,value=latest | |
images: matterminers/${{ matrix.containers }} | |
- name: Login to DockerHub | |
if: github.repository == 'MatterMiners/tardis' && github.ref == 'refs/heads/master' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: containers/${{ matrix.containers }} | |
push: ${{ github.repository == 'MatterMiners/tardis' && github.ref == 'refs/heads/master' }} | |
file: containers/${{ matrix.containers }}/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
SOURCE_BRANCH=${{ github.ref }} | |
SOURCE_REPO_URL=https://github.com/${{ github.repository }} |