Skip to content

Commit

Permalink
Only push a new Docker image on release (colmap#2436)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe authored Feb 21, 2024
1 parent 7730f30 commit cab4f82
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
release:
types: [ published, edited ]

env:
IS_RELEASE: ${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags') }}

jobs:
build:
name: ubuntu-22.04
Expand All @@ -23,6 +26,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: ${{ env.IS_RELEASE == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -31,7 +35,7 @@ jobs:
- name: Build and push
run: |
dockertag=$(date +%Y%m%d).${{ github.run_number }}
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then
cuda_archs="50;60;70;75;90"
else
cuda_archs="50"
Expand All @@ -41,7 +45,7 @@ jobs:
--tag colmap/colmap:$dockertag \
--build-arg COLMAP_GIT_COMMIT="$GITHUB_SHA" \
--build-arg CUDA_ARCHITECTURES="$cuda_archs"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then
docker tag colmap/colmap:$dockertag colmap/colmap:latest
docker push colmap/colmap:$dockertag
docker push colmap/colmap:latest
Expand Down

0 comments on commit cab4f82

Please sign in to comment.