-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (66 loc) · 2.47 KB
/
maven.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# 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
on:
push:
branches: [ "main" ]
tags:
- '*' # Trigger per tutti i tag
pull_request:
branches: [ "main" ]
permissions:
contents: write
id-token: write
actions: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set timezone to Europe/Rome
run: sudo timedatectl set-timezone Europe/Rome
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean install -P jar -DskipTests -Ddependency-check.skip=true
- name: Upload artifact to GitHub
uses: actions/[email protected]
with:
name: govpay-aca-batch
path: target/govpay-aca-batch.jar
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') # Esegui solo per i tag
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: govpay-aca-batch
path: target/ # Assicurati che il file venga scaricato nella cartella target
- name: Rename the artifact file to include the tag
run: cp target/govpay-aca-batch.jar target/govpay-aca-batch-${{ github.ref_name }}.jar # Rinominare il file
- name: List files in target directory
run: ls -l target/
- name: Create GitHub release
id: create_release
uses: softprops/[email protected]
with:
files: target/govpay-aca-batch-${{ github.ref_name }}.jar # Specifica l'artefatto da caricare
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}