-
Notifications
You must be signed in to change notification settings - Fork 47
63 lines (54 loc) · 1.62 KB
/
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
55
56
57
58
59
60
61
62
63
name: docker container
on:
push:
branches:
- '**'
tags:
- v*
pull_request:
branches:
- master
tags:
- v*
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Setup docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: medbha
password: ${{ secrets.DOCKER_TOKEN }}
- name: Step to get tag name
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v3
if: ${{ startsWith(github.ref, 'refs/heads') && github.ref == 'refs/heads/master' }}
with:
context: ci
file: ci/Dockerfile.ubuntu
push: true
tags: hiddensymmetries/simsopt:latest
- name: Build for branches
uses: docker/build-push-action@v3
if: ${{ startsWith(github.ref, 'refs/heads') && github.ref != 'refs/heads/master' }}
with:
context: ci
file: ci/Dockerfile.ubuntu
push: false
tags: hiddensymmetries/simsopt:test
- name: Build and push for tag
uses: docker/build-push-action@v3
if: startsWith(github.event.ref, 'refs/tags/v')
with:
context: ci
file: ci/Dockerfile.ubuntu
push: true
tags: "hiddensymmetries/simsopt:${{steps.vars.outputs.tag}}"