Skip to content

Commit 96a1bd2

Browse files
committed
moar moar 8
1 parent f32e40c commit 96a1bd2

14 files changed

Lines changed: 877 additions & 12 deletions

File tree

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gradle" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily" # Check for updates every day
12+
groups:
13+
# Specify a name for the group, which will be used in pull request titles
14+
# and branch names
15+
dev-dependencies:
16+
# Define patterns to include dependencies in the group (based on
17+
# dependency name)
18+
applies-to: version-updates # Applies the group rule to version updates
19+
patterns:
20+
- "*" # Yolo!
21+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Approve Dependabot Pushes
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.event.pull_request.user.login == 'dependabot[bot]'
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v2
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Enable auto-merge for Dependabot PRs
19+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
20+
env:
21+
PR_URL: ${{github.event.pull_request.html_url}}
22+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
23+
- name: Approve a PR
24+
run: gh pr review --approve "$PR_URL"
25+
env:
26+
PR_URL: ${{github.event.pull_request.html_url}}
27+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/auto-wolpert.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Approve Wolpert Pushes
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
wolpert:
10+
runs-on: ubuntu-latest
11+
if: github.event.pull_request.user.login == 'wolpert'
12+
steps:
13+
- name: Enable auto-merge
14+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
15+
env:
16+
PR_URL: ${{github.event.pull_request.html_url}}
17+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
18+
- name: auto-approve
19+
run: gh pr review --approve "$PR_URL"
20+
env:
21+
PR_URL: ${{github.event.pull_request.html_url}}
22+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/gradle.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Java CI with Gradle
9+
10+
on:
11+
push:
12+
branches: [ "main" ]
13+
pull_request:
14+
branches: [ "main" ]
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up JDK 21
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '21'
29+
distribution: 'temurin'
30+
31+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
32+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
35+
36+
- name: Build with Gradle Wrapper
37+
run: ./gradlew build test
38+
39+
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
40+
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
41+
#
42+
# - name: Setup Gradle
43+
# uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
44+
# with:
45+
# gradle-version: '8.5'
46+
#
47+
# - name: Build with Gradle 8.5
48+
# run: gradle build
49+
50+
dependency-submission:
51+
52+
runs-on: ubuntu-latest
53+
permissions:
54+
contents: write
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
- name: Set up JDK 21
59+
uses: actions/setup-java@v4
60+
with:
61+
java-version: '21'
62+
distribution: 'temurin'
63+
64+
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
65+
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
66+
- name: Generate and submit dependency graph
67+
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Manual Build Release to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
auto-release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # Need full history for git tags
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Get latest tag and increment version
21+
id: version
22+
run: |
23+
# Configure git
24+
git config user.name "github-actions[bot]"
25+
git config user.email "github-actions[bot]@users.noreply.github.com"
26+
27+
# Get the latest tag matching semantic versioning
28+
LATEST_TAG=$(git tag -l "v[0-9]*.[0-9]*.[0-9]*" --sort=-v:refname | head -n 1)
29+
30+
if [ -z "$LATEST_TAG" ]; then
31+
echo "No existing tags found, starting with v0.0.1"
32+
NEW_VERSION="0.0.1"
33+
NEW_TAG="v0.0.1"
34+
else
35+
echo "Latest tag: $LATEST_TAG"
36+
37+
# Extract version without 'v' prefix
38+
VERSION=${LATEST_TAG#v}
39+
40+
# Split version into major.minor.patch
41+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
42+
43+
# Strip any pre-release suffix from patch before incrementing (e.g., "0-alpha" -> "0")
44+
PATCH=${PATCH%%-*}
45+
46+
# Increment patch version
47+
PATCH=$((PATCH + 1))
48+
49+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
50+
NEW_TAG="v$NEW_VERSION"
51+
fi
52+
53+
echo "New version: $NEW_VERSION"
54+
echo "New tag: $NEW_TAG"
55+
56+
# Export to GitHub env
57+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
58+
echo "TAG=$NEW_TAG" >> $GITHUB_ENV
59+
60+
# Create and push the tag
61+
git tag -a "$NEW_TAG" -m "Auto-release $NEW_VERSION"
62+
git push origin "$NEW_TAG"
63+
64+
echo "Created and pushed tag: $NEW_TAG"
65+
66+
- name: Set up JDK 21
67+
uses: actions/setup-java@v4
68+
with:
69+
java-version: '21'
70+
distribution: 'temurin'
71+
cache: 'gradle'
72+
73+
- name: Setup Gradle
74+
uses: gradle/actions/setup-gradle@v3
75+
76+
- name: Verify version matches tag
77+
run: |
78+
GRADLE_VERSION=$(./gradlew properties -q | grep "^version:" | awk '{print $2}')
79+
echo "Gradle version: $GRADLE_VERSION"
80+
echo "Expected version: $VERSION"
81+
if [ "$GRADLE_VERSION" != "$VERSION" ]; then
82+
echo "ERROR: Gradle version ($GRADLE_VERSION) does not match tag version ($VERSION)"
83+
exit 1
84+
fi
85+
86+
- name: Build and test
87+
run: ./gradlew clean build test
88+
89+
- name: Import GPG key
90+
env:
91+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
92+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
93+
run: |
94+
echo "$GPG_PRIVATE_KEY" | base64 -d | gpg --batch --import
95+
# Test signing capability
96+
echo "test" | gpg --clearsign --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" > /dev/null
97+
echo "GPG key imported and tested successfully"
98+
99+
- name: Configure GPG for signing
100+
run: |
101+
# Configure gpg for non-interactive signing
102+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
103+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
104+
gpg-connect-agent reloadagent /bye
105+
106+
- name: Publish to Maven Central
107+
env:
108+
CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
109+
CENTRAL_PORTAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
110+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
111+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
112+
run: |
113+
# Export GPG_TTY for passphrase
114+
export GPG_TTY=$(tty)
115+
116+
# Create gradle.properties with GPG credentials
117+
cat > ~/.gradle/gradle.properties << EOF
118+
signing.gnupg.keyName=$GPG_KEY_ID
119+
signing.gnupg.passphrase=$GPG_PASSPHRASE
120+
EOF
121+
122+
chmod 600 ~/.gradle/gradle.properties
123+
124+
# Publish to Maven Central via Central Portal
125+
./gradlew publishAggregationToCentralPortal \
126+
--no-daemon \
127+
--stacktrace
128+
129+
- name: Build distribution archives
130+
run: |
131+
./gradlew :hofmann-rfc:jar :hofmann-rfc:javadocJar :hofmann-rfc:sourcesJar
132+
./gradlew :hofmann-server:jar :hofmann-server:javadocJar :hofmann-server:sourcesJar
133+
./gradlew :hofmann-client:jar :hofmann-client:javadocJar :hofmann-client:sourcesJar
134+
./gradlew :hofmann-dropwizard:jar :hofmann-dropwizard:javadocJar :hofmann-dropwizard:sourcesJar
135+
./gradlew :hofmann-springboot:jar :hofmann-springboot:javadocJar :hofmann-springboot:sourcesJar
136+
137+
- name: Create GitHub Release
138+
uses: softprops/action-gh-release@v2
139+
with:
140+
tag_name: ${{ env.TAG }}
141+
name: Release ${{ env.VERSION }}
142+
body: |
143+
## Hofmann Elimination ${{ env.VERSION }}
144+
145+
**Auto-released** on merge to main.
146+
147+
### Maven Central
148+
149+
Sample dependency for Maven:
150+
151+
```xml
152+
<dependency>
153+
<groupId>com.codeheadsystems</groupId>
154+
<artifactId>hofmann-rfc</artifactId>
155+
<version>${{ env.VERSION }}</version>
156+
</dependency>
157+
```
158+
159+
```gradle
160+
implementation("com.codeheadsystems:hofmann-rfc:${{ env.VERSION }}")
161+
```
162+
163+
### Modules Published
164+
- `com.codeheadsystems:hofmann-rfc:${{ env.VERSION }}`
165+
- `com.codeheadsystems:hofmann-server:${{ env.VERSION }}`
166+
- `com.codeheadsystems:hofmann-client:${{ env.VERSION }}`
167+
- `com.codeheadsystems:hofmann-dropwizard:${{ env.VERSION }}`
168+
- `com.codeheadsystems:hofmann-springboot:${{ env.VERSION }}`
169+
170+
### What's Changed
171+
See commits since last release for details.
172+
173+
**Note:** Artifacts may take up to 2 hours to appear in Maven Central after release.
174+
files: |
175+
hofmann-rfc/build/libs/*.jar
176+
hofmann-server/build/libs/*.jar
177+
hofmann-client/build/libs/*.jar
178+
hofmann-dropwizard/build/libs/*.jar
179+
hofmann-springboot/build/libs/*.jar
180+
draft: false
181+
prerelease: false
182+
generate_release_notes: true
183+
env:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
186+
- name: Notify on failure
187+
if: failure()
188+
run: |
189+
echo "::error::Auto-release failed! Check logs for details."

0 commit comments

Comments
 (0)