Skip to content

Commit

Permalink
ci: Fix branch build
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Mar 8, 2024
1 parent 4e0a269 commit bd8dfd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/image_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
DOCKER_ORG: ${{ github.repository_owner }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
PROJECT_NAME: caustics

Expand Down Expand Up @@ -56,6 +57,12 @@ jobs:
SHA7="${GITHUB_SHA::7}"
echo "short_sha=${SHA7}" >> $GITHUB_OUTPUT
- name: Extract branch name
id: extract_branch
run:
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >>
$GITHUB_OUTPUT

# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
- name: Free up disk space
run: |
Expand All @@ -72,7 +79,7 @@ jobs:
images:
${{ steps.registry_org.outputs.image_base }}/${{ env.PROJECT_NAME }}
tags: |
type=raw,value=${{ env.GITHUB_REF_NAME }}-cuda-${{ matrix.CUDA_VERSION }}
type=raw,value=${{ steps.extract_branch.outputs.branch }}-cuda-${{ matrix.CUDA_VERSION }}
type=raw,value=${{ steps.github_sha.outputs.short_sha }}-cuda-${{ matrix.CUDA_VERSION }}
- name: Log in to registry
Expand All @@ -96,7 +103,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CAUSTICS_VERSION=${{ env.GITHUB_REF_NAME }}
CAUSTICS_VERSION=${{ steps.extract_branch.outputs.branch }}
CUDA_VERSION=${{ matrix.CUDA_VERSION }}
- name: Inspect Image
Expand Down
3 changes: 2 additions & 1 deletion resources/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ COPY . ${CAUSTICS_HOME}
# Install caustics from a branch or distribution
RUN echo "Installing caustics ..." \
# Allow for "main" or "dev" to be used as a version
; if [[ $CAUSTICS_VERSION = *"main"* || $CAUSTICS_VERSION = *"dev"* ]]; then \
# or if it's pull request 'merge'
; if [[ $CAUSTICS_VERSION = *"main"* || $CAUSTICS_VERSION = *"dev"* || $CAUSTICS_VERSION = *"merge"* ]]; then \
echo "Installing development caustics: ${CAUSTICS_VERSION}..." ; \
pip install -e "${CAUSTICS_HOME}[dev]" \
; else echo "Installing from production distribution version: ${CAUSTICS_VERSION}" ; \
Expand Down

0 comments on commit bd8dfd6

Please sign in to comment.