Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update of files from global .github repo #1285

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/if-docker-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#This action is centrally managed in https://github.com/asyncapi/.github/
#Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
#It does magic only if there is a Dockerfile in the root of the project
name: PR testing - if Docker

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
test-docker-pr:
name: Test Docker build
runs-on: ubuntu-latest

steps:
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'asyncapi-bot-eve' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT

- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v3

- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if project has a Dockerfile
id: docker
run: test -e ./Dockerfile && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash

- if: steps.docker.outputs.exists == 'true'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # use 2.5.0 https://github.com/docker/setup-buildx-action/releases/tag/v2.5.0

- if: steps.docker.outputs.exists == 'true'
name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # use 4.3.0 https://github.com/docker/metadata-action/releases/tag/v4.3.0
with:
images: ${{ env.IMAGE_NAME }}

- if: steps.docker.outputs.exists == 'true'
name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # use 4.0.0 https://github.com/docker/build-push-action/releases/tag/v4.0.0
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
Loading