-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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: Dockerfile.ubuntu | ||
push: true | ||
tags: hiddensymmetries/simsopt_dev: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: Dockerfile.ubuntu | ||
push: false | ||
tags: hiddensymmetries/simsopt_dev: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: Dockerfile.ubuntu | ||
push: true | ||
tags: "hiddensymmetries/simsopt_dev:${{steps.vars.outputs.tag}}" |