Skip to content

Adding github actions support-X1 #11

Adding github actions support-X1

Adding github actions support-X1 #11

Workflow file for this run

name: Build
# when to trigger a pipeline
on:
push:
branches: [ "**" ] # "**" it will trigger for any branch, if "*" if branch name contains '/' it will not work
# we can have multiple jobs build API, build UI
jobs:
build-bookmarker-api:
name: Build bookmarker-api
runs-on: ubuntu-latest # you can specify ubuntu version
defaults:
run:
working-directory: ./bookmarker-api
steps:
- uses: actions/checkout@v4 # checks out code from github
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin' # there are multiple distribution operations.
cache: 'maven'
- name: Build with Maven
run: ./mvnw verify
- if: ${{github.ref == 'refs/heads/main' }}
name: Build and Publish Docker Image
run: |
./mvnw clean package spring-boot:build-image -DskipTests
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push chinmayk/bookmarker-api:latest