Merge pull request #11 from rishab-prasad/riprasad-patch-1 #107
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
name: CI/CD Workflow | |
on: | |
push: | |
pull_request: | |
branches: | |
- master | |
env: | |
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le | |
jobs: | |
build-project: | |
runs-on: ubuntu-latest | |
steps: | |
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Inspect builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: List Files | |
run: ls -alrt | |
- name: Build Project | |
run: ./mvnw package | |
- name: print Context info | |
run: | | |
echo ${{github.event_name}} | |
echo ${{github.ref}} | |
- name: Login in quay.io | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: docker login -u "${{secrets.QUAY_USERNAME}}" -p "${{secrets.QUAY_PASSWORD}}" quay.io | |
- name: Build and Puh image to quay.io | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: docker buildx build --push -f src/main/docker/Dockerfile.jvm -t quay.io/rishabprasad005/my-project:multi-arch --platform ${{env.PLATFORMS}} . | |
- name: Login in dockerhub | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: docker login -u "${{secrets.DOCKERHUB_USERNAME}}" -p "${{secrets.DOCKERHUB_PASSWORD}}" docker.io | |
- name: Build and Puh image to docker.io | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: docker buildx build --push -f src/main/docker/Dockerfile.jvm -t rishabprasad005/my-project:multi-arch --platform ${{env.PLATFORMS}} . | |
- name: List images | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: docker images | |
- name: Google Chat Notification | |
uses: Co-qn/google-chat-notification@releases/v1 | |
if: always() | |
with: | |
name: ${{github.workflow}} | |
url: ${{ secrets.GCHAT_WEBHOOK }} | |
status: ${{ job.status }} | |
trigger-mt-ui-build: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE') | |
runs-on: ubuntu-latest | |
needs: [build-project] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
base: master | |
list-files: 'csv' | |
filters: | | |
src: | |
- 'src/**' | |
- name: Repository Dispatch | |
if: steps.changes.outputs.src == 'true' | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
repository: rishab-prasad/practice-github-actions | |
event-type: on-src-updated |