-
-
Notifications
You must be signed in to change notification settings - Fork 14
54 lines (51 loc) · 1.84 KB
/
build-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Update docker image
on:
workflow_dispatch: # Trigger by hand from the UI
inputs:
branch:
type: choice
description: branch to build the image from
options:
- develop
push:
branches:
- develop
jobs:
build-and-release-docker-image:
name: Builds a dockerimage with the python bindings of preCICE
runs-on: ubuntu-latest
env:
docker_username: precice
steps:
- name: Set branch name for manual triggering
if: github.event_name == 'workflow_dispatch'
shell: bash
run: echo "BINDINGS_REF=${{ inputs.branch }}" >> $GITHUB_ENV
- name: Set branch name for "on pull request" triggering
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
shell: bash
run: echo "BINDINGS_REF=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set PRECICE_TAG and the TAG depending on branch
shell: bash
run: |
echo "PRECICE_TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "Building TAG: ${{ env.BINDINGS_REF }}"
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.docker_username }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Dockerfile
uses: docker/build-push-action@v2
with:
push: true
file: "./tools/releasing/packaging/docker/Dockerfile"
tags: ${{ env.docker_username }}/python-bindings:${{ env.TAG }}
build-args: |
PRECICE_TAG=${{ env.PRECICE_TAG }}
PYTHON_BINDINGS_REF=${{ env.BINDINGS_REF }}