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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/deploy-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ on:
tags:
- 'v*'
- '[0-9]+.[0-9]+.[0-9]+*'
workflow_run:
workflows: ["Finalize GPULlama3 Release"]
types: [completed]
workflow_dispatch:
inputs:
tag:
description: 'Tag to deploy (e.g., v0.2.3) - leave empty to deploy latest tag'
required: false
type: string
dry_run:
description: 'Dry run (skip actual deploy)'
required: false
default: false
type: boolean


jobs:
deploy:
name: Deploy to Maven Central
Expand Down Expand Up @@ -85,4 +93,18 @@ jobs:
--batch-mode
env:
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Deployment Summary
if: ${{ !inputs.dry_run }}
run: |
echo "## πŸš€ Maven Central Deployment" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Detail | Value |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Version | ${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
echo "| GroupId | io.github.beehive-lab |" >> $GITHUB_STEP_SUMMARY
echo "| ArtifactId | gpu-llama3 |" >> $GITHUB_STEP_SUMMARY
echo "| Status | βœ… Deployed |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "πŸ“ [View on Maven Central](https://central.sonatype.com/artifact/io.github.beehive-lab/gpu-llama3/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY
150 changes: 150 additions & 0 deletions .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Finalize GPULlama3 Release

on:
pull_request:
types: [closed]
branches: [main]
workflow_dispatch:
inputs:
version:
description: 'Release version to tag (e.g., 0.2.3)'
required: true
type: string

jobs:
create-release-tag:
# Run when release PR merges OR manual trigger
if: |
(github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')) ||
github.event_name == 'workflow_dispatch'
runs-on: [self-hosted, Linux, x64]
permissions:
contents: write
timeout-minutes: 10

outputs:
version: ${{ steps.get_version.outputs.version }}

steps:
- name: Get version
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
BRANCH="${{ github.event.pull_request.head.ref }}"
echo "version=${BRANCH#release/}" >> $GITHUB_OUTPUT
fi

- name: Checkout main
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Create and push tag
run: |
VERSION="${{ steps.get_version.outputs.version }}"
git tag -a "v${VERSION}" -m "Release ${VERSION}"
git push origin "v${VERSION}"
echo "βœ… Created tag v${VERSION}"

- name: Extract changelog for release notes
id: changelog
run: |
VERSION="${{ steps.get_version.outputs.version }}"
CHANGELOG_FILE="CHANGELOG.md"

if [ -f "$CHANGELOG_FILE" ]; then
# Extract section for this version
awk -v ver="## \\[${VERSION}\\]" '
$0 ~ ver { found=1; next }
found && /^## \[/ { exit }
found { print }
' "$CHANGELOG_FILE" > /tmp/release_notes.txt

if [ -s /tmp/release_notes.txt ]; then
echo "Found changelog section for ${VERSION}"
else
echo "See CHANGELOG.md for details." > /tmp/release_notes.txt
fi
else
echo "See commit history for changes." > /tmp/release_notes.txt
fi

- name: Create GitHub Release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const version = '${{ steps.get_version.outputs.version }}';

let releaseNotes;
try {
releaseNotes = fs.readFileSync('/tmp/release_notes.txt', 'utf8').trim();
if (!releaseNotes) {
releaseNotes = `Release ${version}`;
}
} catch (e) {
releaseNotes = `Release ${version}`;
}

// Add installation instructions
releaseNotes += `\n\n---\n\n### πŸ“¦ Installation\n\n`;
releaseNotes += `**Maven**\n\`\`\`xml\n<dependency>\n <groupId>io.github.beehive-lab</groupId>\n <artifactId>gpu-llama3</artifactId>\n <version>${version}</version>\n</dependency>\n\`\`\`\n\n`;
releaseNotes += `**Gradle**\n\`\`\`groovy\nimplementation 'io.github.beehive-lab:gpu-llama3:${version}'\n\`\`\`\n\n`;
releaseNotes += `---\n\nπŸ“– [Documentation](https://github.com/beehive-lab/GPULlama3.java#readme) | πŸ”— [Maven Central](https://central.sonatype.com/artifact/io.github.beehive-lab/gpu-llama3/${version})`;

const { data: release } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${version}`,
name: `GPULlama3.java ${version}`,
body: releaseNotes,
draft: false,
prerelease: false
});

console.log(`βœ… Created release: ${release.html_url}`);

- name: Summary
run: |
VERSION="${{ steps.get_version.outputs.version }}"
echo "## πŸŽ‰ Release v${VERSION} Finalized" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Step | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Tag created | βœ… v${VERSION} |" >> $GITHUB_STEP_SUMMARY
echo "| GitHub Release | βœ… Created |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### πŸ”„ Next:" >> $GITHUB_STEP_SUMMARY
echo "**Deploy to Maven Central** workflow will trigger automatically" >> $GITHUB_STEP_SUMMARY

cleanup-branch:
needs: create-release-tag
runs-on: [self-hosted, Linux, x64]
permissions:
contents: write
if: github.event_name == 'pull_request'

steps:
- name: Delete release branch
uses: actions/github-script@v7
with:
script: |
const branch = '${{ github.event.pull_request.head.ref }}';
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${branch}`
});
console.log(`βœ… Deleted branch: ${branch}`);
} catch (e) {
console.log(`Could not delete branch: ${e.message}`);
}
Loading