Skip to content

Commit bda2af4

Browse files
committed
ci(github-actions): Add custom GitHub Actions for CI/CD workflows
- Add cache-keys action to generate consistent Gradle and dependencies cache keys - Add create-release action for automated release creation and management - Add extract-versions action to parse and extract version information from configuration files - Add gradle-exec action to execute Gradle commands with proper environment setup - Add maven-version-check action to validate Maven artifact versions - Add publish-report action to publish build reports and test results - Add shared utilities library with cache, GitHub, TOML parsing, and version management helpers - Add test-collector action to aggregate and collect test results from builds - Add TypeScript configuration and build tooling for GitHub Actions development - Add comprehensive property-based and unit tests for all actions - Update CI and Maven Central publish workflows to use new custom actions - Consolidate GitHub Actions infrastructure with proper TypeScript support and testing
1 parent 5715750 commit bda2af4

64 files changed

Lines changed: 8129 additions & 928 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Generate Cache Keys'
2+
description: 'Generate consistent cache keys for Gradle based on gradle files hash'
3+
outputs:
4+
gradle-cache-key:
5+
description: 'Gradle cache key'
6+
value: ${{ steps.generate.outputs.gradle-cache-key }}
7+
deps-cache-key:
8+
description: 'Dependencies cache key'
9+
value: ${{ steps.generate.outputs.deps-cache-key }}
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Generate cache keys
14+
id: generate
15+
shell: bash
16+
run: node ${{ github.action_path }}/dist/index.js

.github/actions/cache-keys/dist/index.js

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@github-actions/cache-keys",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"description": "Generate consistent cache keys for Gradle",
7+
"main": "./dist/index.js",
8+
"scripts": {
9+
"build": "cd ../.. && pnpm build",
10+
"typecheck": "tsc --noEmit",
11+
"test": "vitest run",
12+
"test:watch": "vitest"
13+
},
14+
"dependencies": {
15+
"@github-actions/shared": "workspace:*"
16+
}
17+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Cache Keys Action
3+
*
4+
* Generates consistent cache keys for Gradle builds based on gradle files hash.
5+
* The cache keys are prefixed with the runner OS for cross-platform compatibility.
6+
*
7+
* @module cache-keys
8+
*/
9+
10+
import {
11+
generateCacheKeys,
12+
setOutput,
13+
info,
14+
setFailed,
15+
writeStepSummary,
16+
generateMarkdownTable,
17+
startGroup,
18+
endGroup,
19+
} from '@github-actions/shared';
20+
21+
/**
22+
* Main entry point for the action
23+
*/
24+
async function run(): Promise<void> {
25+
try {
26+
info('Generating cache keys for Gradle...');
27+
28+
startGroup('Cache Key Generation');
29+
30+
// Generate cache keys from workspace root
31+
const cacheKeys = await generateCacheKeys('.');
32+
33+
info(`Gradle cache key: ${cacheKeys.gradleCache}`);
34+
info(`Dependencies cache key: ${cacheKeys.depsCache}`);
35+
36+
endGroup();
37+
38+
// Set outputs
39+
setOutput('gradle-cache-key', cacheKeys.gradleCache);
40+
setOutput('deps-cache-key', cacheKeys.depsCache);
41+
42+
// Write step summary
43+
const summaryTable = generateMarkdownTable(
44+
['Cache Type', 'Key'],
45+
[
46+
['Gradle Cache', `\`${cacheKeys.gradleCache}\``],
47+
['Dependencies Cache', `\`${cacheKeys.depsCache}\``],
48+
]
49+
);
50+
51+
await writeStepSummary(`## 🔑 Generated Cache Keys\n\n${summaryTable}\n\n### Files Included\n\n- \`gradle/wrapper/gradle-wrapper.properties\`\n- \`gradle/libs.versions.toml\`\n- \`build-logic/**/*.gradle.kts\`\n- \`build-logic/**/*.kt\`\n- \`build.gradle.kts\`\n- \`settings.gradle.kts\`\n- \`gradle.properties\``);
52+
53+
info('Cache keys generated successfully!');
54+
} catch (error) {
55+
if (error instanceof Error) {
56+
setFailed(`Action failed: ${error.message}`);
57+
} else {
58+
setFailed('Action failed with unknown error');
59+
}
60+
}
61+
}
62+
63+
// Run the action
64+
run();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "src"
6+
},
7+
"include": [
8+
"src/**/*.ts"
9+
],
10+
"exclude": [
11+
"node_modules",
12+
"dist",
13+
"**/*.test.ts"
14+
]
15+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Create GitHub Release'
2+
description: 'Create a GitHub Release with generated release notes'
3+
inputs:
4+
version:
5+
description: 'Version to release (e.g., 1.0.0 or v1.0.0)'
6+
required: true
7+
group-id:
8+
description: 'Maven group ID'
9+
required: false
10+
default: 'io.github.truenine'
11+
artifacts:
12+
description: 'Comma-separated list of artifacts'
13+
required: false
14+
default: ''
15+
draft:
16+
description: 'Create as draft release'
17+
required: false
18+
default: 'false'
19+
generate-notes:
20+
description: 'Auto-generate release notes from commits'
21+
required: false
22+
default: 'true'
23+
token:
24+
description: 'GitHub token for API access'
25+
required: true
26+
outputs:
27+
release-id:
28+
description: 'ID of the created release'
29+
value: ${{ steps.create.outputs.release-id }}
30+
release-url:
31+
description: 'URL of the created release'
32+
value: ${{ steps.create.outputs.release-url }}
33+
release-created:
34+
description: 'Whether a new release was created'
35+
value: ${{ steps.create.outputs.release-created }}
36+
tag-name:
37+
description: 'Tag name of the release'
38+
value: ${{ steps.create.outputs.tag-name }}
39+
runs:
40+
using: 'composite'
41+
steps:
42+
- name: Create Release
43+
id: create
44+
shell: bash
45+
env:
46+
INPUT_VERSION: ${{ inputs.version }}
47+
INPUT_GROUP_ID: ${{ inputs.group-id }}
48+
INPUT_ARTIFACTS: ${{ inputs.artifacts }}
49+
INPUT_DRAFT: ${{ inputs.draft }}
50+
INPUT_GENERATE_NOTES: ${{ inputs.generate-notes }}
51+
GITHUB_TOKEN: ${{ inputs.token }}
52+
run: node ${{ github.action_path }}/dist/index.js

.github/actions/create-release/dist/index.js

Lines changed: 160 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@github-actions/create-release",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"description": "Create GitHub Release with generated release notes",
7+
"main": "./dist/index.js",
8+
"scripts": {
9+
"build": "cd ../.. && pnpm build",
10+
"typecheck": "tsc --noEmit",
11+
"test": "vitest run",
12+
"test:watch": "vitest"
13+
},
14+
"dependencies": {
15+
"@actions/github": "^6.0.1",
16+
"@github-actions/shared": "workspace:*"
17+
}
18+
}

0 commit comments

Comments
 (0)