Skip to content

Adding first pipeline to the project #12

Adding first pipeline to the project

Adding first pipeline to the project #12

name: CI/CD pipeline for successful merge
on:
workflow_dispatch:
pull_request:
branches:
- master
- feature/github-actions
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: '21'
cache: 'maven'
distribution: 'corretto'
- name: Add executable permissions
run: chmod a+x mvnw
- name: Maven install dependencies
run: ./mvnw clean install package
# - name: Upload JAR artifact
# uses: actions/upload-artifact@v4
# with:
# name: app-protector
# path: ./target/*.jar
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/apiprotector:${{ github.sha }}