-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move actions to lhm_actions #8
Changes from 22 commits
9e6c081
013f456
2ad8f06
1f907c5
3c4d8af
6a442c2
328a10f
1477f8c
54a7f7b
5eaa09d
ae0862c
66a5146
de9b323
26bd8ea
39199c1
287523b
bc9d7b0
5a407b6
0e9b883
a9aaecf
23616bc
2eb04d4
5f44eee
f057430
5adb104
d51bbcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# https://vitepress.dev/guide/deploy#github-pages | ||
name: Build docs | ||
|
||
inputs: | ||
docs-path: | ||
required: false | ||
default: "./docs" | ||
type: string | ||
description: Path to vitepress docs project | ||
node-version: | ||
required: false | ||
default: "22" | ||
type: string | ||
description: Node version | ||
build-cmd: | ||
required: false | ||
default: "build" | ||
type: string | ||
description: Change build command, if using vuepress | ||
dist-path: | ||
required: false | ||
default: ".vitepress/dist" | ||
type: string | ||
description: Vitepress output path, which should be uploaded to github pages | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 0 # Required for vitepress lastUpdated | ||
- name: Setup Node | ||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
cache: npm | ||
cache-dependency-path: "${{ inputs.docs-path }}/package-lock.json" | ||
- name: Setup Pages | ||
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 | ||
- name: Install dependencies | ||
run: npm --prefix ./${{inputs.docs-path }} ci | ||
shell: bash | ||
- name: Run lint | ||
run: npm run --prefix ./${{inputs.docs-path}} lint | ||
shell: bash | ||
- name: Build with VitePress | ||
run: npm --prefix ./${{inputs.docs-path }} run ${{ inputs.build-cmd }} | ||
shell: bash | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | ||
with: | ||
path: ${{ inputs.docs-path }}/${{ inputs.dist-path }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: "Build Docker Image" | ||
description: "Builds and pushes a docker image" | ||
|
||
inputs: | ||
registry: | ||
description: "Image registry to push image to" | ||
required: true | ||
default: ghcr.io | ||
registry-username: | ||
description: "Username to authenticate against image registry" | ||
required: true | ||
registry-password: | ||
description: "Username to authenticate against image registry" | ||
required: true | ||
image-tags: | ||
description: "Tags to tag image with" | ||
required: false | ||
default: | | ||
type=raw,value=latest | ||
image-labels: | ||
description: "Labels to add to image" | ||
required: false | ||
default: | | ||
org.opencontainers.image.description=See ${{ github.server_url }}/${{ github.repository }} | ||
path: | ||
description: "Path to the Dockerfile to build image from" | ||
required: true | ||
image-name: | ||
description: "Name to give the image" | ||
required: true | ||
artifact-name: | ||
description: "name where you download artifact" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: ${{ inputs.artifact-name }} | ||
- name: Login to Registry | ||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | ||
with: | ||
registry: ${{ inputs.registry }} | ||
username: ${{ inputs.registry-username }} | ||
password: ${{ inputs.registry-password }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1 | ||
with: | ||
images: "${{ inputs.registry }}/${{ github.repository }}/${{ inputs.image-name }}" | ||
tags: ${{inputs.image-tags}} | ||
labels: ${{inputs.image-labels}} | ||
- name: Build and push image | ||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 | ||
with: | ||
context: ./${{ inputs.path }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: "Checkout Code" | ||
description: "A wrapper for actions/checkout with no args" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Advanced CodeQL action" | ||
description: "Scans a repository using provided CodeQL language, buildmode and query scan set" | ||
|
||
inputs: | ||
codeql-language: | ||
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed | ||
description: "CodeQL language name to scan with (e.g java-kotlin, javascript-typescript, python, ...)" | ||
required: true | ||
codeql-buildmode: | ||
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#codeql-build-modes | ||
description: "Build mode to use when scanning the source code (e.g. none, autobuild, manual)" | ||
required: false | ||
default: "none" | ||
codeql-query: | ||
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#using-queries-in-ql-packs | ||
description: "Query set to use when analyzing the source code (e.g. default, security-extended, security-and-quality)" | ||
required: false | ||
default: "security-and-quality" | ||
java-version: | ||
default: "21" | ||
type: string | ||
description: Temurin JDK version to use for autobuild (only when codeql-language is java-kotlin and codeql-build is set to autobuild) | ||
path: | ||
description: "Path to scan files in" | ||
required: false | ||
default: "." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Well-Defined Input Parameters |
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up JDK | ||
if: inputs.codeql-language == 'java-kotlin' && inputs.codeql-buildmode == 'autobuild' | ||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | ||
with: | ||
java-version: ${{ inputs.java-version }} | ||
distribution: "temurin" | ||
cache: "maven" | ||
cache-dependency-path: "${{ inputs.path }}/pom.xml" | ||
- name: Initialize CodeQL for ${{ inputs.codeql-language }} | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ inputs.codeql-language }} | ||
build-mode: ${{ inputs.codeql-buildmode }} | ||
queries: ${{ inputs.codeql-query }} | ||
- if: inputs.codeql-buildmode == 'autobuild' | ||
name: Build using Autobuild | ||
uses: github/codeql-action/autobuild@v3 | ||
with: | ||
working-directory: ${{ inputs.path }} | ||
- name: Perform CodeQL analysis for ${{ inputs.codeql-language }} | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{ inputs.codeql-language }}-/path:${{ inputs.path }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Create GitHub Release | ||
description: "Creates a GitHub Release of a Maven Artifact" | ||
inputs: | ||
artifact-name: | ||
required: true | ||
type: string | ||
description: "name of the artifact to download" | ||
tag-name: | ||
required: true | ||
type: string | ||
description: "Name of a tag (e.g. sps-1.0.0 or myproject-1.0.0)" | ||
artifact-path: | ||
required: true | ||
type: string | ||
description: "path to the artifacts (e.g. ./target/*.jar)" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download a single artifact | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: ${{inputs.artifact-name}} | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1 | ||
with: | ||
tag_name: ${{inputs.tag-name}} | ||
draft: false | ||
prerelease: false | ||
generate_release_notes: false | ||
files: | | ||
${{inputs.artifact-path}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Deploy docs | ||
inputs: | ||
artifact_name: | ||
description: "The name of the artifact to deploy" | ||
default: "github-pages" | ||
required: false | ||
type: string | ||
deploy-branch: | ||
required: false | ||
type: string | ||
default: "main" | ||
description: "Branch to deploy documentation from" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
if: (github.ref_name == inputs.deploy-branch) | ||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 | ||
with: | ||
artifact_name: ${{ inputs.artifact_name }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Compliance check and build test | ||
|
||
inputs: | ||
java-version: | ||
required: false | ||
default: "21" | ||
type: string | ||
description: set the java version | ||
app-path: | ||
required: true | ||
type: string | ||
description: path to the pom.xml | ||
outputs: | ||
artifact-name: | ||
description: "name of the artifact upload" | ||
value: ${{steps.artifact-name.outputs.artifact-name}} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | ||
with: | ||
java-version: ${{ inputs.java-version }} | ||
distribution: "temurin" | ||
cache: "maven" | ||
cache-dependency-path: "./${{inputs.app-path}}/pom.xml" | ||
- name: Build with Maven | ||
run: mvn --update-snapshots -f ./${{inputs.app-path}}/pom.xml install | ||
shell: bash | ||
- id: artifact-name | ||
run: echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
- id: upload-artifact | ||
name: "Upload Artifact" | ||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | ||
with: | ||
name: ${{steps.artifact-name.outputs.artifact-name}} | ||
path: "**/target" | ||
retention-days: 5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Maven Release | ||
|
||
inputs: | ||
java-version: | ||
required: false | ||
default: 21 | ||
type: string | ||
description: configure the java version | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
app-path: | ||
required: true | ||
type: string | ||
description: path where the pom.xml is | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Input Parameter: java-version and app-path
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
releaseVersion: | ||
required: true | ||
type: string | ||
description: version which will be released | ||
developmentVersion: | ||
required: true | ||
type: string | ||
description: next version with snapshot | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
skipDeployment: | ||
default: true | ||
type: boolean | ||
description: skip deployment to maven central | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
SIGN_KEY_PASS: | ||
required: true | ||
type: string | ||
description: env variable for GPG private key passphrase | ||
CENTRAL_USERNAME: | ||
required: true | ||
type: string | ||
description: env variable for username in deploy | ||
CENTRAL_PASSWORD: | ||
required: true | ||
type: string | ||
description: env variable for token in deploy | ||
GPG_PRIVATE_KEY: | ||
required: true | ||
type: string | ||
description: Value of the GPG private key to import | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
outputs: | ||
MVN_ARTIFACT_ID: | ||
description: "artifact name from pom" | ||
value: ${{ steps.maven-release-step.outputs.MVN_ARTIFACT_ID }} | ||
artifact-name: | ||
description: "name of the artifact upload" | ||
value: ${{steps.artifact-name.outputs.artifact-name}} | ||
|
||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Checkout source code, set up Java, etc. Then... | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
java-version: ${{ inputs.java-version }} | ||
distribution: "temurin" | ||
cache: "maven" | ||
cache-dependency-path: "./${{ inputs.app-path}}/pom.xml" | ||
server-id: "central" | ||
server-username: ${{ inputs.CENTRAL_USERNAME }} | ||
server-password: ${{ inputs.CENTRAL_PASSWORD }} | ||
gpg-private-key: ${{ inputs.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: ${{ inputs.SIGN_KEY_PASS }} | ||
- name: Maven Release Step | ||
id: maven-release-step | ||
shell: bash | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
MVN_ARTIFACT_ID=$(mvn -f .${{inputs.app-path}}/pom.xml org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -q -DforceStdout) | ||
echo $MVN_ARTIFACT_ID | ||
echo "MVN_ARTIFACT_ID=$MVN_ARTIFACT_ID" >> $GITHUB_OUTPUT | ||
mvn release:prepare release:perform -f .${{inputs.app-path}}/pom.xml -B -DreleaseVersion=${{ inputs.releaseVersion }} -DdevelopmentVersion=${{ inputs.developmentVersion }} -Darguments="-Dmaven.deploy.skip=${{ inputs.skipDeployment }}" | ||
ejcsid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env: | ||
SIGN_KEY_PASS: ${{ inputs.GPG_PRIVATE_KEY }} | ||
CENTRAL_USERNAME: ${{ inputs.CENTRAL_USERNAME }} | ||
CENTRAL_PASSWORD: ${{ inputs.CENTRAL_PASSWORD }} | ||
|
||
- id: artifact-name | ||
run: echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
- name: "Upload Artifact" | ||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | ||
with: | ||
name: ${{steps.artifact-name.outputs.artifact-name}} | ||
path: "**/target" | ||
retention-days: 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Input Parameters Definition Check
All inputs (such as
registry
,registry-username
,registry-password
,image-tags
,image-labels
,path
,image-name
, andartifact-name
) are thoroughly documented with appropriate defaults and descriptions. For multi-line defaults (e.g., forimage-tags
andimage-labels
), consider using a consistent YAML block format if needed for clarity.