Skip to content

Commit 4d8770d

Browse files
authored
Merge pull request #84 from TrueNine/dev
Dev
2 parents 52c0c9d + eec6ac5 commit 4d8770d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+8229
-937
lines changed

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.tmp/
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+
"type": "module",
4+
"version": "1.0.0",
5+
"private": true,
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+
endGroup,
12+
generateCacheKeys,
13+
generateMarkdownTable,
14+
info,
15+
setFailed,
16+
setOutput,
17+
startGroup,
18+
writeStepSummary,
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+
"rootDir": "src",
5+
"outDir": "dist"
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: 161 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+
"type": "module",
4+
"version": "1.0.0",
5+
"private": true,
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)