forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add path check to gha (open-telemetry#1052)
* add path check to gha * get path from dockerfile * fix lint * override skip on push * remove set_output usages * fix lint * fix --------- Co-authored-by: Carter Socha <[email protected]> Co-authored-by: Juliano Costa <[email protected]>
- Loading branch information
1 parent
db1a6aa
commit 7d57217
Showing
1 changed file
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'src/**' | ||
- 'test/**' | ||
workflow_call: | ||
inputs: | ||
push: | ||
|
@@ -93,35 +98,48 @@ jobs: | |
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check for file changes | ||
id: check_changes | ||
if: ${{ !inputs.push }} | ||
run: | | ||
DOCKERFILE_DIR=$(dirname ${{ matrix.file_tag.file }}) | ||
FILES_CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- $DOCKERFILE_DIR) | ||
if [ -z "$FILES_CHANGED" ]; then | ||
echo "No changes in ${{ matrix.file_tag.context }}, skipping build." | ||
echo "skip=true >> $GITHUB_OUTPUT" | ||
else | ||
echo "Changes detected in ${{ matrix.file_tag.context }}, proceeding with build." | ||
echo "skip=false >> $GITHUB_OUTPUT" | ||
fi | ||
- name: Override skip for push | ||
if: ${{ inputs.push }} | ||
run: echo "skip=false >> $GITHUB_OUTPUT" | ||
id: override_skip | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
if: ${{ inputs.push }} | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
if: ${{ inputs.push }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
image: tonistiigi/binfmt:master | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 2 | ||
max-parallelism = 2 | ||
- name: Matrix Build and push demo images | ||
if: steps.check_changes.outputs.skip == 'false' || steps.override_skip.outputs.skip == 'false' | ||
uses: docker/[email protected] | ||
with: | ||
context: ${{ matrix.file_tag.context }} | ||
|