Skip to content

Commit

Permalink
Update docker-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
troytc authored Nov 7, 2024
1 parent ee6a5a3 commit cda7d6a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,29 @@ jobs:

echo "Latest release published at: $published_at (UTC)"
echo "Time difference: $time_difference hours"
echo "::set-output name=latest_version::$latest_version"
echo "::set-output name=should_build::$(( time_difference < 24 ))"
echo "SHOULD_BUILD=$(( time_difference < 24 ))" >> $GITHUB_ENV

- name: Check Manual Trigger
if: github.event_name == 'workflow_dispatch'
run: |
echo "Manual trigger detected. Forcing build."
echo "::set-output name=should_build::1"
echo "SHOULD_BUILD=true" >> $GITHUB_ENV
- name: Checkout Repository
if: steps.check_release_time.outputs.should_build == '1'
if: $SHOULD_BUILD == true
uses: actions/checkout@v3

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
if: steps.check_release_time.outputs.should_build == '1'
if: $SHOULD_BUILD == true
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log Into Registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request' && steps.check_release_time.outputs.should_build == '1'
if: github.event_name != 'pull_request' && $SHOULD_BUILD == true
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -88,7 +87,7 @@ jobs:
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker Metadata
if: steps.check_release_time.outputs.should_build == '1'
if: $SHOULD_BUILD == true
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
Expand All @@ -97,7 +96,7 @@ jobs:
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker Image
if: steps.check_release_time.outputs.should_build == '1'
if: $SHOULD_BUILD == true
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
Expand Down

0 comments on commit cda7d6a

Please sign in to comment.