-
Notifications
You must be signed in to change notification settings - Fork 22
97 lines (86 loc) · 3.44 KB
/
release.yml
File metadata and controls
97 lines (86 loc) · 3.44 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release
# Triggers on a v*.*.* tag push and creates a GitHub Release with the
# Keploy Java agent jar attached as a downloadable asset. Maven Central
# publishing happens in parallel via the Woodpecker pipeline at
# .woodpecker/release.yml — this workflow does not touch Central.
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve release version
id: ver
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Set release version in poms
run: >-
mvn -B -ntp versions:set
-DnewVersion=${{ steps.ver.outputs.version }}
-DprocessAllModules=true
-DgenerateBackupPoms=false
- name: Build agent jar with sources and javadoc
# `release` profile attaches the source jar; the inner pom always
# attaches the javadoc jar. -Dgpg.skip=true keeps the signing step
# in the release profile inert (signing happens on Woodpecker
# where the GPG key is wired up).
run: mvn -B -ntp -P release -DskipTests -Dgpg.skip=true clean verify
- name: Smoke test java agent
run: ./scripts/smoke-javaagent.sh
- name: Stage release assets
run: |
set -euxo pipefail
version="${{ steps.ver.outputs.version }}"
mkdir -p release-assets
cp "keploy-sdk/target/keploy-sdk-${version}.jar" "release-assets/keploy-sdk-${version}.jar"
cp "keploy-sdk/target/keploy-sdk-${version}.jar" "release-assets/keploy-sdk.jar"
if [[ -f "keploy-sdk/target/keploy-sdk-${version}-sources.jar" ]]; then
cp "keploy-sdk/target/keploy-sdk-${version}-sources.jar" "release-assets/"
fi
if [[ -f "keploy-sdk/target/keploy-sdk-${version}-javadoc.jar" ]]; then
cp "keploy-sdk/target/keploy-sdk-${version}-javadoc.jar" "release-assets/"
fi
cp "keploy-sdk/pom.xml" "release-assets/keploy-sdk-${version}.pom"
ls -la release-assets/
- name: Publish GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
set -euxo pipefail
# Pre-release flag: anything with a hyphen suffix (e.g. v2.0.6-rc1)
prerelease_flag=()
if [[ "$TAG" == *-* ]]; then
prerelease_flag=(--prerelease)
fi
# Idempotent publish: if a previous run already created the
# release record, --clobber overwrites partial assets so a
# rerun ends in the same state either way.
if gh release view "$TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
echo "Release $TAG already exists — uploading assets with --clobber"
gh release upload "$TAG" \
--repo "${{ github.repository }}" \
--clobber \
release-assets/*
else
gh release create "$TAG" \
--repo "${{ github.repository }}" \
--title "Java SDK $TAG" \
--target "${{ github.sha }}" \
--generate-notes \
"${prerelease_flag[@]}" \
release-assets/*
fi