Skip to content

Merge pull request #8 from abhishekmalvadkar/GH-1_create-and-setup-in… #12

Merge pull request #8 from abhishekmalvadkar/GH-1_create-and-setup-in…

Merge pull request #8 from abhishekmalvadkar/GH-1_create-and-setup-in… #12

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- '**' # Runs for all branches
workflow_dispatch:
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master' # Runs on all branches except master
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Make Maven wrapper executable
run: chmod +x mvnw
- name: Build and Run Tests
run: ./mvnw --no-transfer-progress clean verify
- if: ${{ github.ref == 'refs/heads/master' }}
name: Publish to GitHub Packages Apache Maven
run: ./mvnw deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
deploy:
name: Build, Test & Deploy
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # Runs only on master
permissions:
contents: read
packages: write # Needed to publish to GitHub Packages
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
cache: 'maven'
- name: Make Maven wrapper executable
run: chmod +x mvnw
- name: Build and Deploy to GitHub Packages
run: ./mvnw --no-transfer-progress clean deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}