Skip to content

Commit c4dc81f

Browse files
cuioss-oliverclaude
andcommitted
chore: update GitHub Actions to use reusable workflows
- Update project.yml to new structured schema format - Replace inline maven.yml with reusable workflow caller - Replace inline maven-release.yml with reusable release.yml caller - Add scorecards.yml for OpenSSF Scorecard security analysis - Add dependency-review.yml for PR dependency scanning All workflows now call cuioss-organization reusable workflows pinned to v0.2.0 (SHA: 288f393bf5407c87ffd95c128cdf694761941308) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4fb4182 commit c4dc81f

File tree

6 files changed

+74
-190
lines changed

6 files changed

+74
-190
lines changed

.github/project.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/cuioss/cuioss-organization/main/.github/actions/read-project-config/schema.json
12
name: cui-java-module-template
2-
pages-reference: cui-java-module-template
3-
sonar-project-key: cuioss_cui-java-module-template
3+
description: Template for cuioss Java modules
4+
45
release:
56
current-version: 1.0.0
67
next-version: 1.1.0-SNAPSHOT
8+
create-github-release: true
9+
10+
maven-build:
11+
java-versions: '["21","25"]'
12+
java-version: '21'
13+
enable-snapshot-deploy: true
14+
maven-profiles-snapshot: 'release-snapshot,javadoc'
15+
maven-profiles-release: 'release,javadoc'
16+
npm-cache: false
17+
18+
sonar:
19+
project-key: cuioss_cui-java-module-template
20+
enabled: true
21+
skip-on-dependabot: true
22+
23+
pages:
24+
reference: cui-java-module-template
25+
deploy-at-release: true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Example: Copy this to your repo as .github/workflows/dependency-review.yml
2+
name: Dependency Review
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
dependency-review:
8+
uses: cuioss/cuioss-organization/.github/workflows/reusable-dependency-review.yml@288f393bf5407c87ffd95c128cdf694761941308 # v0.2.0
9+
secrets: inherit

.github/workflows/maven-release.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/maven.yml

Lines changed: 11 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,18 @@
1-
name: Master Build
1+
# Example: Copy this to your repo as .github/workflows/maven.yml
2+
# Configuration is read from .github/project.yml - no inputs needed!
3+
name: Maven Build
24

35
on:
46
push:
5-
branches: [ "main", "feature/*" ]
7+
branches: [main, "feature/*", "fix/*", "dependabot/**"]
68
pull_request:
7-
branches: [ "main" ]
9+
branches: [main]
10+
workflow_dispatch:
811

912
jobs:
1013
build:
11-
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
version: [ 21,24 ]
16-
17-
steps:
18-
- name: Harden the runner (Audit all outbound calls)
19-
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
20-
with:
21-
egress-policy: audit
22-
23-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24-
- name: Set up JDK ${{ matrix.version }}
25-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
26-
with:
27-
java-version: ${{ matrix.version }}
28-
distribution: 'temurin'
29-
cache: maven
30-
- name: Build with Maven, Java ${{ matrix.version }}
31-
run: ./mvnw --no-transfer-progress verify -Dmaven.compiler.release=${{ matrix.version }}
32-
33-
sonar-build:
34-
needs: build
35-
runs-on: ubuntu-latest
36-
37-
steps:
38-
- name: Harden the runner (Audit all outbound calls)
39-
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
40-
with:
41-
egress-policy: audit
42-
43-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44-
with:
45-
fetch-depth: 0
46-
47-
- name: Set up JDK 21 for Sonar-build
48-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
49-
with:
50-
java-version: '21'
51-
distribution: 'temurin'
52-
cache: maven
53-
54-
- name: Cache SonarCloud packages
55-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
56-
with:
57-
path: ~/.sonar/cache
58-
key: ${{ runner.os }}-sonar
59-
restore-keys: ${{ runner.os }}-sonar
60-
61-
- uses: radcortez/project-metadata-action@203f7ffba8db2669b2c9b4d4c2e90b186c588fa5 # 1.1
62-
name: Retrieve project metadata from '.github/project.yml'
63-
id: metadata
64-
with:
65-
github-token: ${{secrets.GITHUB_TOKEN}}
66-
metadata-file-path: '.github/project.yml'
67-
local-file: true
68-
69-
- name: Build and analyze
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
72-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
73-
run: ./mvnw -B --no-transfer-progress verify -Psonar -Dsonar.projectKey=${{steps.metadata.outputs.sonar-project-key}} sonar:sonar
74-
75-
deploy-snapshot:
76-
needs: sonar-build
77-
if: github.ref == 'refs/heads/main'
78-
runs-on: ubuntu-latest
79-
steps:
80-
- name: Harden the runner (Audit all outbound calls)
81-
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
82-
with:
83-
egress-policy: audit
84-
85-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
86-
- name: Set up JDK 17 for snapshot release
87-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
88-
with:
89-
java-version: '21'
90-
distribution: 'temurin'
91-
server-id: central
92-
server-username: MAVEN_USERNAME
93-
server-password: MAVEN_PASSWORD
94-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
95-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
96-
cache: maven
97-
98-
- name: Extract project version
99-
id: project
100-
run: echo ::set-output name=version::$(./mvnw --no-transfer-progress help:evaluate -Dexpression=project.version -q -DforceStdout)
101-
102-
- name: Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
103-
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
104-
run: |
105-
./mvnw -B --no-transfer-progress -Prelease-snapshot,javadoc deploy -Dmaven.test.skip=true
106-
env:
107-
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
108-
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
109-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
14+
# Run on push events, OR on pull_request only if from a fork
15+
# This prevents duplicate runs: push handles internal branches, PR handles forks
16+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
17+
uses: cuioss/cuioss-organization/.github/workflows/reusable-maven-build.yml@288f393bf5407c87ffd95c128cdf694761941308 # v0.2.0
18+
secrets: inherit

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Example: Copy this to your repo as .github/workflows/release.yml
2+
# Configuration is read from .github/project.yml - no inputs needed!
3+
name: Release
4+
5+
on:
6+
pull_request:
7+
types: [closed]
8+
paths:
9+
- '.github/project.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
release:
17+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
18+
uses: cuioss/cuioss-organization/.github/workflows/reusable-maven-release.yml@288f393bf5407c87ffd95c128cdf694761941308 # v0.2.0
19+
secrets: inherit

.github/workflows/scorecards.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Example: Copy this to your repo as .github/workflows/scorecards.yml
2+
name: Scorecard supply-chain security
3+
4+
on:
5+
branch_protection_rule:
6+
schedule:
7+
- cron: '20 7 * * 2'
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
analysis:
13+
uses: cuioss/cuioss-organization/.github/workflows/reusable-scorecards.yml@288f393bf5407c87ffd95c128cdf694761941308 # v0.2.0
14+
secrets: inherit

0 commit comments

Comments
 (0)