Skip to content

feat: add asyncapi file birth timestamp in metrics collection. #42

feat: add asyncapi file birth timestamp in metrics collection.

feat: add asyncapi file birth timestamp in metrics collection. #42

#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