Skip to content

master

master #56

Workflow file for this run

name: master
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "develop" branch
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Set up Maven
env:
MAVEN_USERNAME: antpas14
MAVEN_TOKEN: ${{ secrets.MAVEN_PAT }}
run: |
echo "Setting up Maven with credentials..."
echo "<settings><servers><server><id>github</id><username>${MAVEN_USERNAME}</username><password>${MAVEN_TOKEN}</password></server></servers></settings>" > $HOME/.m2/settings.xml
- name: Build with Maven
run: mvn clean install -s $HOME/.m2/settings.xml
- name: Temporarily save jar artifact
uses: actions/upload-artifact@v2
with:
name: jar-artifact
path: ${{ github.workspace }}/target/*.jar
retention-days: 1
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/fantaleghe-backend:latest
-
name: Upload to code cov
uses: codecov/codecov-action@v3