Skip to content

Commit

Permalink
pybamm-team#3312 initial setup, configure release tags via name
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Dec 28, 2023
1 parent 6f9ce65 commit 3cd6573
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create tags for Docker images based on build-time arguments
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' && github.event_name != 'release'
id: tags
run: |
if [ "${{ matrix.build-args }}" = "No solvers" ]; then
Expand All @@ -50,7 +51,24 @@ jobs:
echo "tag=all" >> "$GITHUB_OUTPUT"
fi
- name: Create tags for Docker images based on build-time arguments (release)
if: github.event_name == 'release' && github.event.action == 'published'
id: tags-release
run: |
if [ "${{ matrix.build-args }}" = "No solvers" ]; then
echo "tag=${{ github.event.release.name }}-latest" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "JAX" ]; then
echo "tag=${{ github.event.release.name }}-jax" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "ODES" ]; then
echo "tag=${{ github.event.release.name }}-odes" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "IDAKLU" ]; then
echo "tag=${{ github.event.release.name }}-idaklu" >> "$GITHUB_OUTPUT"
elif [ "${{ matrix.build-args }}" = "ALL" ]; then
echo "tag=${{ github.event.release.name }}-all" >> "$GITHUB_OUTPUT"
fi
- name: Build and push Docker image to Docker Hub (${{ matrix.build-args }})
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' && github.event_name != 'release'
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -59,5 +77,12 @@ jobs:
push: true
platforms: linux/amd64, linux/arm64

- name: List built image(s)
run: docker images
- name: Build and push Docker image to Docker Hub (${{ matrix.build-args}}) (Release)
if: github.event_name == 'release' && github.event.action == 'published'
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:${{ steps.tags-release.outputs.tag }}
push: true
platforms: linux/amd64, linux/arm64

0 comments on commit 3cd6573

Please sign in to comment.