Skip to content

Commit 08a034e

Browse files
committed
chore: updating the workflows
Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
1 parent ed22f59 commit 08a034e

File tree

3 files changed

+37
-48
lines changed

3 files changed

+37
-48
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
java-version: ['17', '21', '25']
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
- name: Set up JDK ${{ matrix.java-version }}
2323
uses: actions/setup-java@v4
2424
with:
@@ -29,7 +29,7 @@ jobs:
2929
run: mvn -B package --file pom.xml -fae
3030
- name: Upload Test Reports
3131
if: failure()
32-
uses: actions/upload-artifact@v4
32+
uses: actions/upload-artifact@v6
3333
with:
3434
name: surefire-reports-java-${{ matrix.java-version }}
3535
path: |
@@ -39,7 +39,7 @@ jobs:
3939
if-no-files-found: warn
4040
- name: Upload Build Logs
4141
if: failure()
42-
uses: actions/upload-artifact@v4
42+
uses: actions/upload-artifact@v6
4343
with:
4444
name: build-logs-java-${{ matrix.java-version }}
4545
path: |
Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
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.
1+
name: Build with '-Prelease' (Trigger)
42

3+
# Trigger workflow for release profile build verification.
4+
# This workflow runs on PRs and uploads the PR info for the workflow_run job.
5+
# The actual build with secrets happens in build-with-release-profile-run.yml
6+
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests
57

68
on:
7-
# Handle all branches for now
9+
pull_request: # Changed from pull_request_target for security
810
push:
9-
pull_request_target:
1011
workflow_dispatch:
1112

1213
# Only run the latest job
@@ -15,47 +16,35 @@ concurrency:
1516
cancel-in-progress: true
1617

1718
jobs:
18-
build:
19+
trigger:
1920
# Only run this job for the main repository, not for forks
2021
if: github.repository == 'a2aproject/a2a-java'
2122
runs-on: ubuntu-latest
2223
permissions:
2324
contents: read
2425

2526
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
27+
- name: Prepare PR info
4628
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-
# Build with the same settings as the deploy job
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 }}
29+
mkdir -p pr_info
30+
31+
# Store PR number for workflow_run job
32+
if [ "${{ github.event_name }}" = "pull_request" ]; then
33+
echo ${{ github.event.number }} > pr_info/pr_number
34+
echo ${{ github.event.pull_request.head.sha }} > pr_info/pr_sha
35+
echo ${{ github.event.pull_request.head.ref }} > pr_info/pr_ref
36+
else
37+
# For push events, store the commit sha
38+
echo ${{ github.sha }} > pr_info/pr_sha
39+
echo ${{ github.ref }} > pr_info/pr_ref
40+
fi
41+
42+
echo "Event: ${{ github.event_name }}"
43+
cat pr_info/*
44+
45+
- name: Upload PR info
46+
uses: actions/upload-artifact@v6
47+
with:
48+
name: pr-info
49+
path: pr_info/
50+
retention-days: 1

.github/workflows/cloud-deployment-example.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ jobs:
1616
timeout-minutes: 30
1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v4
20-
19+
uses: actions/checkout@v6
2120
- name: Set up JDK 17
2221
uses: actions/setup-java@v5
2322
with:
@@ -27,7 +26,7 @@ jobs:
2726

2827
- name: Install Kind
2928
run: |
30-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
29+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-amd64
3130
chmod +x ./kind
3231
sudo mv ./kind /usr/local/bin/kind
3332
kind version
@@ -58,7 +57,8 @@ jobs:
5857
mvn test-compile exec:java \
5958
-Dexec.mainClass="io.a2a.examples.cloud.A2ACloudExampleClient" \
6059
-Dexec.classpathScope=test \
61-
-Dagent.url=http://localhost:8080
60+
-Dagent.url=http://localhost:8080 \
61+
-Dci.mode=true
6262
6363
- name: Show diagnostics on failure
6464
if: failure()

0 commit comments

Comments
 (0)