Skip to content

Commit 814bcf1

Browse files
committed
prepare release
1 parent c0bf3e8 commit 814bcf1

File tree

3 files changed

+147
-23
lines changed

3 files changed

+147
-23
lines changed

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release Jar
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: 'Release tag to create or update, for example v1.0.0'
11+
required: true
12+
type: string
13+
release_name:
14+
description: 'Optional release title'
15+
required: false
16+
default: ''
17+
type: string
18+
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
21+
22+
permissions:
23+
contents: write
24+
25+
concurrency:
26+
group: release-${{ github.ref_name || inputs.tag_name }}
27+
cancel-in-progress: false
28+
29+
jobs:
30+
release:
31+
name: Build and publish release jar
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Set up JDK 8
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: temurin
44+
java-version: '8'
45+
cache: maven
46+
47+
- name: Resolve release metadata
48+
id: meta
49+
shell: bash
50+
run: |
51+
set -euo pipefail
52+
53+
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
54+
tag_name="${{ inputs.tag_name }}"
55+
release_name="${{ inputs.release_name }}"
56+
else
57+
tag_name="${GITHUB_REF_NAME}"
58+
release_name=""
59+
fi
60+
61+
if [[ -z "${release_name}" ]]; then
62+
release_name="${tag_name}"
63+
fi
64+
65+
echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT"
66+
echo "release_name=${release_name}" >> "$GITHUB_OUTPUT"
67+
68+
- name: Build jars
69+
run: mvn -B -ntp clean verify
70+
71+
- name: Collect release assets
72+
shell: bash
73+
run: |
74+
set -euo pipefail
75+
mkdir -p dist
76+
cp target/*.jar dist/
77+
(cd dist && sha256sum *.jar > SHA256SUMS)
78+
ls -lh dist
79+
80+
- name: Upload workflow artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: java-code-tracer-release-${{ steps.meta.outputs.tag_name }}
84+
path: dist/*
85+
if-no-files-found: error
86+
87+
- name: Publish GitHub release
88+
env:
89+
GH_TOKEN: ${{ github.token }}
90+
shell: bash
91+
run: |
92+
set -euo pipefail
93+
94+
tag_name="${{ steps.meta.outputs.tag_name }}"
95+
release_name="${{ steps.meta.outputs.release_name }}"
96+
notes_file="$(mktemp)"
97+
98+
cat > "$notes_file" <<EOF
99+
Automated release for ${tag_name}.
100+
101+
Download the fat jar if you want to run JCT directly as a Java agent:
102+
- java-code-tracer-<version>-jar-with-dependencies.jar
103+
104+
Integrity information:
105+
- SHA256SUMS
106+
EOF
107+
108+
if gh release view "$tag_name" >/dev/null 2>&1; then
109+
gh release upload "$tag_name" dist/* --clobber
110+
else
111+
gh release create "$tag_name" dist/* \
112+
--title "$release_name" \
113+
--notes-file "$notes_file" \
114+
--target "$GITHUB_SHA"
115+
fi
116+

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ If you work in a legacy app and ask things like "Can we remove this?" or "Is thi
1212
- [Recommended Local Workflow: ELK](#recommended-local-workflow-elk)
1313
- [Project Status](#project-status)
1414
- [Java Version](#java-version)
15+
- [Download a Release Jar](#download-a-release-jar)
1516
- [Build](#build)
1617
- [Configure](#configure)
1718
- [Run an Application with JCT](#run-an-application-with-jct)
@@ -51,11 +52,13 @@ This is especially useful before deleting legacy code, splitting modules, or tig
5152

5253
If you just want first results quickly:
5354

54-
1. Build JCT
55+
1. Download the release jar or build JCT locally
5556
2. Start your app with `-javaagent` and a config
5657
3. Inspect generated events (file output or ELK stack)
5758

58-
Minimum commands:
59+
Fastest path: download the fat jar from GitHub Releases and use it directly.
60+
61+
Manual build commands:
5962

6063
```bash
6164
mvn clean package
@@ -101,10 +104,31 @@ This project targets Java 8 bytecode and is currently focused on practical runti
101104
JCT is compiled against Java 8 (`-source 8 -target 8`) and intentionally uses no APIs beyond that level.
102105
This is a deliberate choice — the primary target is legacy and monolithic systems that are often stuck on older JVMs.
103106

104-
It runs fine on newer JVMs (11, 17, 21, …) without any changes.
107+
It runs fine on newer JVMs (11, 17, 21, ...) without any changes.
108+
109+
## Download a Release Jar
110+
111+
If you do not want to build JCT locally, download the prebuilt agent jar here:
112+
113+
- [GitHub Releases](https://github.com/niesfisch/java-code-tracer/releases)
114+
- [Release workflow runs and downloadable artifacts](https://github.com/niesfisch/java-code-tracer/actions/workflows/release.yml)
115+
116+
Use this file as your Java agent:
117+
118+
- `java-code-tracer-<version>-jar-with-dependencies.jar`
119+
120+
The release workflow publishes the jar in two places:
121+
122+
- as a GitHub Release asset for tagged releases
123+
- as a workflow artifact for each `Release Jar` workflow run
124+
125+
For maintainers: pushing a tag like `v1.0.0` starts the release workflow automatically.
126+
You can also trigger `Release Jar` manually in GitHub Actions and provide a tag name.
105127

106128
## Build
107129

130+
Build locally with Maven if you prefer or if you want to modify the project:
131+
108132
```bash
109133
mvn clean package
110134
```
@@ -113,6 +137,8 @@ The distributable agent jar is created at:
113137

114138
- `target/java-code-tracer-1.0-SNAPSHOT-jar-with-dependencies.jar`
115139

140+
That is the jar you should use with `-javaagent`.
141+
116142
## Configure
117143

118144
Create a local config file:
@@ -301,4 +327,3 @@ Use the following IntelliJ Run/Debug VM options example when attaching JCT as a
301327
## License
302328

303329
[MIT](LICENSE.txt)
304-

pom.xml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
<java.version>8</java.version>
15-
<maven.compiler.source>${java.version}</maven.compiler.source>
16-
<maven.compiler.target>${java.version}</maven.compiler.target>
15+
<maven.compiler.release>${java.version}</maven.compiler.release>
1716
<maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
1817
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
1918
<maven.assembly.plugin.version>3.7.1</maven.assembly.plugin.version>
@@ -32,22 +31,7 @@
3231
</license>
3332
</licenses>
3433

35-
<repositories>
36-
<repository>
37-
<id>Sonatype-public</id>
38-
<name>SnakeYAML repository</name>
39-
<url>http://oss.sonatype.org/content/groups/public/</url>
40-
</repository>
41-
</repositories>
42-
4334
<dependencies>
44-
<dependency>
45-
<groupId>com.sun</groupId>
46-
<artifactId>tools</artifactId>
47-
<version>1.6.0</version>
48-
<scope>system</scope>
49-
<systemPath>${java.home}/../lib/tools.jar</systemPath>
50-
</dependency>
5135
<dependency>
5236
<groupId>org.yaml</groupId>
5337
<artifactId>snakeyaml</artifactId>
@@ -97,8 +81,7 @@
9781
<artifactId>maven-compiler-plugin</artifactId>
9882
<version>${maven.compiler.plugin.version}</version>
9983
<configuration>
100-
<source>${maven.compiler.source}</source>
101-
<target>${maven.compiler.target}</target>
84+
<release>${maven.compiler.release}</release>
10285
</configuration>
10386
</plugin>
10487

0 commit comments

Comments
 (0)