Skip to content

Commit

Permalink
Update and rename maven.yml to ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelPelegrina authored Mar 25, 2024
1 parent ba33772 commit 6acd293
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/maven.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven
name: CI Workflow

on:
push:
push:
branches: [ "master" ]
pull_request:
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build:

build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres

env:
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}

options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -46,7 +36,25 @@ jobs:
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Build and test
run: chmod +x mvnw && ./mvnw clean package
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v1
with:
images: migupele/java_school_online_store_api
- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

0 comments on commit 6acd293

Please sign in to comment.