Skip to content

Commit 36827d8

Browse files
committed
Updating github-actions
1 parent 26b2361 commit 36827d8

File tree

2 files changed

+126
-134
lines changed

2 files changed

+126
-134
lines changed

.github/workflows/maven-release.yml

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Maven Release
22

33
on:
44
pull_request:
5-
types: [closed]
5+
types: [ closed ]
66
paths:
77
- '.github/project.yml'
88
workflow_dispatch:
@@ -13,69 +13,69 @@ jobs:
1313
name: release
1414

1515
steps:
16-
- uses: actions/checkout@v4
17-
with:
18-
persist-credentials: false # otherwise, the token used is the PA_TOKEN, instead of your personal access token.
19-
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false # otherwise, the token used is the PA_TOKEN, instead of your personal access token.
19+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
2020

21-
- uses: radcortez/project-metadata-action@1.1
22-
name: Retrieve project metadata from '.github/project.yml'
23-
id: metadata
24-
with:
25-
github-token: ${{secrets.GITHUB_TOKEN}}
26-
metadata-file-path: '.github/project.yml'
27-
local-file: true
21+
- uses: radcortez/project-metadata-action@1.1
22+
name: Retrieve project metadata from '.github/project.yml'
23+
id: metadata
24+
with:
25+
github-token: ${{secrets.GITHUB_TOKEN}}
26+
metadata-file-path: '.github/project.yml'
27+
local-file: true
2828

29-
- name: Set up JDK 17
30-
uses: actions/setup-java@v4
31-
with:
32-
java-version: '17'
33-
distribution: 'temurin'
34-
server-id: sonatype-nexus-snapshots
35-
server-username: MAVEN_USERNAME
36-
server-password: MAVEN_CENTRAL_TOKEN
37-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
38-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39-
cache: maven
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '17'
33+
distribution: 'temurin'
34+
server-id: sonatype-nexus-snapshots
35+
server-username: MAVEN_USERNAME
36+
server-password: MAVEN_CENTRAL_TOKEN
37+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
38+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39+
cache: maven
4040

41-
- name: Configure Git author
42-
run: |
43-
git config --local user.email "action@github.com"
44-
git config --local user.name "Cuioss Robot Action"
41+
- name: Configure Git author
42+
run: |
43+
git config --local user.email "action@github.com"
44+
git config --local user.name "Cuioss Robot Action"
4545
46-
- name: Maven release ${{steps.metadata.outputs.current-version}}
47-
run: |
48-
git checkout -b release
49-
./mvnw -B -Prelease release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
50-
./mvnw -B -Prelease javadoc:aggregate site:site site:stage
51-
git checkout ${{vars.GITHUB_BASE_REF}}
52-
git rebase release
53-
./mvnw -B -Prelease release:perform -DskipTests
54-
env:
55-
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
56-
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
57-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
46+
- name: Maven release ${{steps.metadata.outputs.current-version}}
47+
run: |
48+
git checkout -b release
49+
./mvnw -B -Prelease release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
50+
./mvnw -B -Prelease javadoc:aggregate site:site site:stage
51+
git checkout ${{vars.GITHUB_BASE_REF}}
52+
git rebase release
53+
./mvnw -B -Prelease release:perform -DskipTests
54+
env:
55+
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
56+
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
57+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5858

59-
- name: Deploy Maven Site to cuioss.github.io -> ${{steps.metadata.outputs.pages-reference}}🚀
60-
uses: JamesIves/github-pages-deploy-action@v4
61-
with:
62-
folder: target/site
63-
repository-name: cuioss/cuioss.github.io
64-
target-folder: ${{steps.metadata.outputs.pages-reference}}
65-
branch: main
66-
token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
67-
#
68-
- name: Push changes to ${{github.ref_name}}
69-
uses: ad-m/github-push-action@v0.8.0
70-
with:
71-
github_token: ${{ secrets.GITHUB_TOKEN }}
72-
branch: ${{github.ref_name}}
73-
force: true
59+
- name: Deploy Maven Site to cuioss.github.io -> ${{steps.metadata.outputs.pages-reference}}🚀
60+
uses: JamesIves/github-pages-deploy-action@v4
61+
with:
62+
folder: target/site
63+
repository-name: cuioss/cuioss.github.io
64+
target-folder: ${{steps.metadata.outputs.pages-reference}}
65+
branch: main
66+
token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
7467

75-
- name: Push tag ${{steps.metadata.outputs.current-version}}
76-
uses: ad-m/github-push-action@v0.8.0
77-
with:
78-
branch: ${{github.ref_name}}
79-
github_token: ${{ secrets.GITHUB_TOKEN }}
80-
tags: true
81-
force: true
68+
- name: Push changes to ${{github.ref_name}}
69+
uses: ad-m/github-push-action@v0.8.0
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
branch: ${{github.ref_name}}
73+
force: true
74+
75+
- name: Push tag ${{steps.metadata.outputs.current-version}}
76+
uses: ad-m/github-push-action@v0.8.0
77+
with:
78+
branch: ${{github.ref_name}}
79+
github_token: ${{ secrets.GITHUB_TOKEN }}
80+
tags: true
81+
force: true

.github/workflows/maven.yml

Lines changed: 65 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
91
name: Master Build
102

113
on:
124
push:
13-
branches: [ "main" ]
5+
branches: [ "main", "feature/*" ]
146
pull_request:
157
branches: [ "main" ]
168

@@ -20,84 +12,84 @@ jobs:
2012
runs-on: ubuntu-latest
2113
strategy:
2214
matrix:
23-
version: [17,21,23]
15+
version: [ 17,21,23 ]
2416

2517
steps:
26-
- uses: actions/checkout@v4
27-
- name: Set up JDK ${{ matrix.version }}
28-
uses: actions/setup-java@v4
29-
with:
30-
java-version: ${{ matrix.version }}
31-
distribution: 'temurin'
32-
cache: maven
33-
- name: Build with Maven, Java ${{ matrix.version }}
34-
run: ./mvnw -B verify -Dmaven.compiler.source=${{ matrix.version }} -Dmaven.compiler.target=${{ matrix.version }}
18+
- uses: actions/checkout@v4
19+
- name: Set up JDK ${{ matrix.version }}
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: ${{ matrix.version }}
23+
distribution: 'temurin'
24+
cache: maven
25+
- name: Build with Maven, Java ${{ matrix.version }}
26+
run: ./mvnw --no-transfer-progress verify -Dmaven.compiler.source=${{ matrix.version }} -Dmaven.compiler.target=${{ matrix.version }}
3527

3628
sonar-build:
3729
needs: build
3830
runs-on: ubuntu-latest
3931

4032
steps:
41-
- uses: actions/checkout@v4
42-
with:
43-
fetch-depth: 0
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Set up JDK 17 for Sonar-build
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: '17'
41+
distribution: 'temurin'
42+
cache: maven
43+
44+
- name: Cache SonarCloud packages
45+
uses: actions/cache@v3
46+
with:
47+
path: ~/.sonar/cache
48+
key: ${{ runner.os }}-sonar
49+
restore-keys: ${{ runner.os }}-sonar
4450

45-
- name: Set up JDK 17 for Sonar-build
46-
uses: actions/setup-java@v4
47-
with:
48-
java-version: '17'
49-
distribution: 'temurin'
50-
cache: maven
51+
- uses: radcortez/project-metadata-action@master
52+
name: Retrieve project metadata from '.github/project.yml'
53+
id: metadata
54+
with:
55+
github-token: ${{secrets.GITHUB_TOKEN}}
56+
metadata-file-path: '.github/project.yml'
57+
local-file: true
5158

52-
- name: Cache SonarCloud packages
53-
uses: actions/cache@v3
54-
with:
55-
path: ~/.sonar/cache
56-
key: ${{ runner.os }}-sonar
57-
restore-keys: ${{ runner.os }}-sonar
58-
59-
- uses: radcortez/project-metadata-action@1.1
60-
name: Retrieve project metadata from '.github/project.yml'
61-
id: metadata
62-
with:
63-
github-token: ${{secrets.GITHUB_TOKEN}}
64-
metadata-file-path: '.github/project.yml'
65-
local-file: true
66-
67-
- name: Build and analyze
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
70-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
71-
run: ./mvnw -B verify -Psonar -Dsonar.projectKey=${{steps.metadata.outputs.sonar-project-key}} sonar:sonar
59+
- name: Build and analyze
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
62+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
63+
run: ./mvnw -B verify -Psonar -Dsonar.projectKey=${{steps.metadata.outputs.sonar-project-key}} sonar:sonar
7264

7365
deploy-snapshot:
7466
needs: sonar-build
75-
if: github.event_name != 'pull_request'
67+
if: github.ref == 'refs/heads/main'
7668
runs-on: ubuntu-latest
7769
steps:
78-
- uses: actions/checkout@v4
79-
- name: Set up JDK 17 for snapshot release
80-
uses: actions/setup-java@v4
81-
with:
82-
java-version: '17'
83-
distribution: 'temurin'
84-
server-id: sonatype-nexus-snapshots
85-
server-username: MAVEN_USERNAME
86-
server-password: MAVEN_CENTRAL_TOKEN
87-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
88-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
89-
cache: maven
70+
- uses: actions/checkout@v4
71+
- name: Set up JDK 17 for snapshot release
72+
uses: actions/setup-java@v4
73+
with:
74+
java-version: '17'
75+
distribution: 'temurin'
76+
server-id: sonatype-nexus-snapshots
77+
server-username: MAVEN_USERNAME
78+
server-password: MAVEN_CENTRAL_TOKEN
79+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
80+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
81+
cache: maven
9082

91-
- name: Extract project version
92-
id: project
93-
run: echo ::set-output name=version::$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
83+
- name: Extract project version
84+
id: project
85+
run: echo ::set-output name=version::$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
9486

95-
- name: Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
96-
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
97-
run: |
98-
./mvnw -B -Prelease-snapshot javadoc:aggregate
99-
./mvnw -B -Prelease-snapshot deploy -Dmaven.test.skip=true
100-
env:
101-
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
102-
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
103-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
87+
- name: Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
88+
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
89+
run: |
90+
./mvnw -B -Prelease-snapshot javadoc:aggregate
91+
./mvnw -B -Prelease-snapshot deploy -Dmaven.test.skip=true
92+
env:
93+
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
94+
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
95+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)