-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (115 loc) · 5.27 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (115 loc) · 5.27 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Java Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
JAVA_HOME: ${{ github.workspace }}/graalvm-ce-java11-22.3.3
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up JDK 11 from GraalVM
run: |
echo "${{ env.JAVA_HOME }}/bin" >> $GITHUB_PATH
wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.3/graalvm-ce-java11-linux-amd64-22.3.3.tar.gz
tar -xvzf graalvm-ce-java11-linux-amd64-22.3.3.tar.gz
${{ env.JAVA_HOME }}/bin/gu install native-image
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build and Test
id: build
continue-on-error: true # Allow the workflow to continue if this fails
run: ./gradlew clean fatJar
- name: Delete tag on failure
if: steps.build.outcome != 'success'
run: |
git push --delete origin ${GITHUB_REF#refs/tags/}
exit 1 # Fail the workflow
# The tag must match gradle.properties: it names the jar, the wheel, and the GitHub Release,
# and a mismatch would publish the wrong version to PyPI.
- name: Resolve and verify version
id: ver
run: |
version="${GITHUB_REF#refs/tags/v}"
declared="$(sed -n 's/^version=//p' gradle.properties)"
if [[ "$version" != "$declared" ]]; then
echo "::error::Tag version ($version) != gradle.properties version ($declared). Bump gradle.properties or fix the tag."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
# Stage release assets: a stable-named codeanalyzer.jar (what the installer fetches), the
# Neo4j schema contract (platform-independent, version-locked to this build), and the
# cargo-dist-style install script.
- name: Stage release assets (jar + Neo4j schema + installer)
run: |
mkdir -p release-assets
cp build/libs/codeanalyzer-${{ steps.ver.outputs.version }}.jar release-assets/codeanalyzer.jar
cp build/libs/codeanalyzer-${{ steps.ver.outputs.version }}.jar "release-assets/codeanalyzer-${{ steps.ver.outputs.version }}.jar"
java -jar build/libs/codeanalyzer-${{ steps.ver.outputs.version }}.jar --emit schema > release-assets/schema.neo4j.json
cp packaging/install/codeanalyzer-installer.sh release-assets/codeanalyzer-installer.sh
ls -lh release-assets
# The PyPI wheel is published by release-pypi.yml, which runs when this workflow publishes
# the GitHub Release and builds the wheel from the released codeanalyzer.jar asset.
- name: Build Changelog
id: gen_changelog
uses: mikepenz/release-changelog-builder-action@v6
with:
failOnError: "true"
configuration: .github/workflows/release_config.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# cargo-dist-style release notes: install one-liner + downloads, then the generated changelog.
- name: Compose release notes
id: notes
run: |
{
echo "## Install"
echo
echo '```sh'
echo "pip install codeanalyzer-java==${{ steps.ver.outputs.version }} # bundles a JVM; installs the canjv launcher"
echo '```'
echo
echo "Or the jar with a \`codeanalyzer\` launcher (requires Java 11+):"
echo
echo '```sh'
echo "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/${GITHUB_REPOSITORY}/releases/download/v${{ steps.ver.outputs.version }}/codeanalyzer-installer.sh | sh"
echo '```'
echo
echo "Or run the JAR directly (requires Java 11+):"
echo
echo '```sh'
echo "# JSON output, at the analysis level you ask for"
echo "java -jar codeanalyzer.jar -i /path/to/project -a 4 -o ./out # writes out/analysis.json"
echo
echo "# Neo4j projection - always full depth, so it takes no --analysis-level"
echo "java -jar codeanalyzer.jar -i /path/to/project --emit neo4j -o ./out # writes out/graph.cypher"
echo '```'
echo
echo "## Downloads"
echo
echo "| Asset | Description |"
echo "| --- | --- |"
echo "| \`codeanalyzer.jar\` | Self-contained analyzer (run with \`java -jar\`) |"
echo "| \`codeanalyzer-installer.sh\` | Installer that fetches the jar and adds a \`codeanalyzer\` launcher |"
echo "| \`schema.neo4j.json\` | Neo4j graph schema contract (node labels, relationships, DDL) |"
echo
echo "---"
echo
echo "${{ steps.gen_changelog.outputs.changelog }}"
} > release-notes.md
- name: Publish Release
uses: softprops/action-gh-release@v3
with:
files: |
release-assets/codeanalyzer.jar
release-assets/codeanalyzer-${{ steps.ver.outputs.version }}.jar
release-assets/schema.neo4j.json
release-assets/codeanalyzer-installer.sh
body_path: release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}