Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 64 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Configuration for Release Drafter: https://github.com/release-drafter/release-drafter
name-template: $NEXT_PATCH_VERSION
tag-template: $NEXT_PATCH_VERSION

template: |
$CHANGES

## OpenAPI spec

<!-- OPENAPI_DIFF -->

categories:
- title: 🚀 New features and improvements
labels:
- enhancement
- title: 🐛 Bug fixes
labels:
- bug
- title: 📝 Documentation updates
labels:
- documentation
- title: 👻 Maintenance
labels:
- chore
- maintenance
- title: 🚦 Tests
labels:
- test
- title: ✍ Other changes
- title: 📦 Dependency updates
labels:
- dependencies
collapse-after: 5
- title: 🔐 Security
labels:
- "🔐 security"

exclude-labels:
- skip-changelog
- invalid

autolabeler:
- label: documentation
files:
- "*.md"

version-resolver:
major:
labels:
- major
- breaking
minor:
labels:
- minor
- enhancement
patch:
labels:
- patch
- bug
- chore
- maintenance
- dependencies
- documentation
default: patch
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ on:
jobs:
build:
name: Build Rootly API v1
runs-on: ubuntu-latest
runs-on: blacksmith-2vcpu-ubuntu-2404
strategy:
matrix:
java: [ 17, 21 ]
java: [ 17, 21, 25 ]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up JDK
Expand Down
49 changes: 2 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: write
contents: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down Expand Up @@ -48,48 +48,3 @@ jobs:
run: mvn --batch-mode deploy -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Extract changelog for version
id: changelog
run: |
# Extract the section for this version from CHANGELOG.md
VERSION="${{ steps.version.outputs.version }}"

# Get changelog content between version headers
CHANGELOG=$(awk "/## \[$VERSION\]/,/## \[/" CHANGELOG.md | sed '1d;$d' | sed '/^$/d')

# If changelog extraction failed, use a default message
if [ -z "$CHANGELOG" ]; then
CHANGELOG="Release version $VERSION

See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) for details."
fi

# Save to output using heredoc to handle multiline content
{
echo 'notes<<EOF'
echo "$CHANGELOG"
echo EOF
} >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const tag = context.ref.replace('refs/tags/', '');
const version = tag.replace('v', '');

await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
name: `Release ${version}`,
body: `${{ steps.changelog.outputs.notes }}`,
draft: false,
prerelease: version.includes('-') || version.includes('alpha') || version.includes('beta') || version.includes('rc')
});
138 changes: 138 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Release Drafter

on:
push:
branches:
- master
tags:
- "v*"
workflow_dispatch: {}

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Install oasdiff
env:
OASDIFF_VERSION: 1.28.0
run: |
curl -fsSL -o /tmp/oasdiff.tar.gz \
"https://github.com/oasdiff/oasdiff/releases/download/v${OASDIFF_VERSION}/oasdiff_${OASDIFF_VERSION}_linux_amd64.tar.gz"
tar -xzf /tmp/oasdiff.tar.gz -C /usr/local/bin oasdiff

- name: Generate OpenAPI diff since last release
run: |
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | grep -v "^${GITHUB_REF_NAME}$" | head -1)
if [ -n "$LATEST_TAG" ] && git show "${LATEST_TAG}:api/openapi.yaml" > /tmp/base-openapi.yaml 2>/dev/null; then
CHANGELOG=$(oasdiff changelog --format markdown /tmp/base-openapi.yaml api/openapi.yaml || true)
if [ -z "$CHANGELOG" ] || echo "$CHANGELOG" | grep -q "No changes detected"; then
SUMMARY="_No API changes detected._"
echo "OPENAPI_HAS_CHANGES=false" >> "$GITHUB_ENV"
else
CHANGE_COUNT=$(echo "$CHANGELOG" | grep -c '^- ' || echo 0)
BREAKING_OUTPUT=$(oasdiff breaking --format text /tmp/base-openapi.yaml api/openapi.yaml 2>/dev/null || true)
BREAKING_COUNT=$(echo "$BREAKING_OUTPUT" | grep -c '^error' || echo 0)
WARNING_COUNT=$(echo "$BREAKING_OUTPUT" | grep -c '^warning' || echo 0)
COUNTS="${CHANGE_COUNT} API change(s)"
if [ "$BREAKING_COUNT" -gt 0 ] && [ "$WARNING_COUNT" -gt 0 ]; then
COUNTS="${COUNTS} (${BREAKING_COUNT} breaking, ${WARNING_COUNT} potentially breaking)"
elif [ "$BREAKING_COUNT" -gt 0 ]; then
COUNTS="${COUNTS} (${BREAKING_COUNT} breaking)"
elif [ "$WARNING_COUNT" -gt 0 ]; then
COUNTS="${COUNTS} (${WARNING_COUNT} potentially breaking)"
fi
SUMMARY="This release includes ${COUNTS}, via [\`oasdiff\`](https://github.com/oasdiff/oasdiff). The full changelog [can be found attached to this release](<!-- ASSET_URL -->)."
if [ "$BREAKING_COUNT" -gt 0 ] || [ "$WARNING_COUNT" -gt 0 ]; then
BREAKING_MD=$(oasdiff breaking --format markdown /tmp/base-openapi.yaml api/openapi.yaml 2>/dev/null || true)
SUMMARY=$(printf '%s\n\n<details>\n<summary>Breaking and potentially breaking changes</summary>\n\n%s\n\n</details>' "$SUMMARY" "$BREAKING_MD")
fi
echo "OPENAPI_HAS_CHANGES=true" >> "$GITHUB_ENV"
fi
elif [ -n "$LATEST_TAG" ]; then
SUMMARY="_No OpenAPI spec found for tag \`${LATEST_TAG}\`._"
echo "OPENAPI_HAS_CHANGES=false" >> "$GITHUB_ENV"
else
SUMMARY="_No previous release tag found._"
echo "OPENAPI_HAS_CHANGES=false" >> "$GITHUB_ENV"
fi
echo "$SUMMARY" > /tmp/openapi-summary.txt
echo "${CHANGELOG:-}" > /tmp/openapi-diff.md

- id: release_drafter
uses: release-drafter/release-drafter@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
with:
name: ${{ github.ref_type == 'tag' && github.ref_name || 'next' }}
tag: ${{ github.ref_type == 'tag' && github.ref_name || 'next' }}
version: ${{ github.ref_type == 'tag' && github.ref_name || 'next' }}
publish: ${{ github.ref_type == 'tag' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Inject OpenAPI diff into release body
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require('fs');
const releaseId = ${{ steps.release_drafter.outputs.id }};
const hasChanges = '${{ env.OPENAPI_HAS_CHANGES }}' === 'true';
const summary = fs.readFileSync('/tmp/openapi-summary.txt', 'utf8').trim();

let inlineContent = summary;

if (hasChanges) {
const { data: assets } = await github.rest.repos.listReleaseAssets({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
});
const existing = assets.find(a => a.name === 'openapi-diff.md');
if (existing) {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: existing.id,
});
}

const diff = fs.readFileSync('/tmp/openapi-diff.md', 'utf8');
const { data: asset } = await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
name: 'openapi-diff.md',
data: diff,
});

inlineContent = summary.replace('<!-- ASSET_URL -->', asset.browser_download_url);
}

const { data: release } = await github.rest.repos.getRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
});

const bodyLimit = 125000;
let newBody = release.body.replace('<!-- OPENAPI_DIFF -->', inlineContent);
if (newBody.length > bodyLimit) {
const fallback = inlineContent.replace(/<details>[\s\S]*<\/details>/, '_Breaking and potentially breaking changes omitted — see attached `openapi-diff.md` for details._');
newBody = release.body.replace('<!-- OPENAPI_DIFF -->', fallback);
}

await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
body: newBody,
});
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up JDK
Expand All @@ -19,4 +19,4 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Run tests
run: ./gradlew test --no-daemon
run: ./gradlew test --no-daemon
4 changes: 4 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
# Protect custom files from regeneration
build.gradle
pom.xml
gradlew
gradlew.bat
gradle/wrapper/**
LICENSE
README.md
CLAUDE.md
PUBLISHING.md
CHANGELOG.md
.github/dependabot.yml
.github/workflows/maven.yml
Loading
Loading