Automatically attach artifacts to release #26
This file contains hidden or 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" | |
| # build and publish different docker images | |
| on: | |
| pull_request: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: 'Select which dockerfile to build (note: "manylinux" times out currently)' | |
| required: true | |
| options: | |
| - main | |
| - manylinux | |
| tag: | |
| description: "Tag for the Docker image" | |
| required: true | |
| default: "latest" | |
| push: | |
| description: "Push docker image to container registry once built?" | |
| required: true | |
| default: "false" | |
| jobs: | |
| deployment: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: ubuntu-latest | |
| arch: "x86_64" | |
| - name: ubuntu-24.04-arm | |
| arch: "aarch64" | |
| runs-on: ${{ matrix.platform.name }} | |
| steps: | |
| - name: Set defaults | |
| id: run_configuration | |
| run: | | |
| echo "target=${{ github.event.inputs.target || 'main' }}" >> $GITHUB_OUTPUT | |
| echo "tag=${{ github.event.inputs.tag || 'latest' }}" >> $GITHUB_OUTPUT | |
| echo "should_push=${{ github.event.inputs.push || github.event_name == 'release' }}" >> $GITHUB_OUTPUT | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Determine docker image source | |
| shell: bash | |
| run: | | |
| if [[ "${{ steps.run_configuration.outputs.target }}" == "main" ]]; then | |
| echo "DOCKERFILE_PATH=Dockerfile" >> $GITHUB_ENV | |
| echo "DOCKER_REPO_TAG=ghcr.io/virtualcell/vcell_fvsolver_${{ matrix.platform.arch }}:${{ steps.run_configuration.outputs.tag }}" >> $GITHUB_ENV | |
| elif [[ "${{ steps.run_configuration.outputs.target }}" == "manylinux" ]]; then | |
| echo "DOCKERFILE_PATH=docker/Dockerfile_fvsolver_manylinux_2_34_${{ matrix.platform.arch }}" >> $GITHUB_ENV | |
| echo "DOCKER_REPO_TAG=ghcr.io/virtualcell/fvsolver_manylinux_2_34_${{ matrix.platform.arch }}:${{ steps.run_configuration.outputs.tag }}" >> $GITHUB_ENV | |
| else | |
| echo "Error: Unknown target requested" >&2 | |
| exit 1 | |
| fi | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ env.DOCKERFILE_PATH }} | |
| push: ${{ steps.run_configuration.outputs.should_push }} | |
| tags: ${{ env.DOCKER_REPO_TAG }} | |
| - name: Setup Debug-shell Session on Failure | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ failure() }} | |
| with: | |
| limit-access-to-actor: true |