Skip to content

Commit a3fb5f0

Browse files
authored
chore: Add workflow to build with -Prelease (#405)
1 parent 350501f commit a3fb5f0

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build with '-Prelease'
2+
3+
# Simply runs the build with -Prelease to avoid nasty surprises when running the release-to-maven-central workflow.
4+
5+
6+
on:
7+
# Handle all branches for now
8+
push:
9+
pull_request:
10+
workflow_dispatch:
11+
12+
# Only run the latest job
13+
concurrency:
14+
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
# Only run this job for the main repository, not for forks
20+
if: github.repository == 'a2aproject/a2a-java'
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '17'
33+
distribution: 'temurin'
34+
cache: maven
35+
36+
# Use secrets to import GPG key
37+
- name: Import GPG key
38+
uses: crazy-max/ghaction-import-gpg@v6
39+
with:
40+
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
41+
passphrase: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
42+
43+
# Create settings.xml for Maven since it needs the 'central-a2asdk-temp' server.
44+
# Populate wqith username and password from secrets
45+
- name: Create settings.xml
46+
run: |
47+
mkdir -p ~/.m2
48+
echo "<settings><servers><server><id>central-a2asdk-temp</id><username>${{ secrets.CENTRAL_TOKEN_USERNAME }}</username><password>${{ secrets.CENTRAL_TOKEN_PASSWORD }}</password></server></servers></settings>" > ~/.m2/settings.xml
49+
50+
# Deploy to Maven Central
51+
# -s uses the settings file we created.
52+
- name: Build with same arguments as deploy job
53+
run: >
54+
mvn -B install
55+
-s ~/.m2/settings.xml
56+
-P release
57+
-DskipTests
58+
-Drelease.auto.publish=true
59+
env:
60+
# GPG passphrase is set as an environment variable for the gpg plugin to use
61+
GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}

0 commit comments

Comments
 (0)