2025-01-07 05:58:42 +01:00
|
|
|
---
|
2025-01-07 09:11:46 +01:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
name: "Setup Java environment"
|
|
|
|
description: "Initialize Java Environment and retrieve secrets from Vault"
|
|
|
|
author: Oliver Weyhmüller
|
2025-01-07 06:54:09 +01:00
|
|
|
inputs:
|
2025-01-07 09:11:46 +01:00
|
|
|
roleid:
|
|
|
|
description: "Role ID of Approle"
|
|
|
|
default: ""
|
|
|
|
secretid:
|
|
|
|
description: "Secret ID of Approle"
|
|
|
|
default: ""
|
2025-01-07 13:33:16 +01:00
|
|
|
outputs:
|
|
|
|
gituser:
|
|
|
|
description: User to use for git operations
|
|
|
|
value: ${{ steps.import-gpg.outputs.name }}
|
|
|
|
gitemail:
|
|
|
|
description: Email to use for git operations
|
|
|
|
value: ${{ steps.import-gpg.outputs.email }}
|
2025-01-07 05:58:42 +01:00
|
|
|
runs:
|
2025-01-07 09:11:46 +01:00
|
|
|
using: "composite"
|
2025-01-07 05:58:42 +01:00
|
|
|
steps:
|
2025-01-07 09:11:46 +01:00
|
|
|
- name: "Import Secrets"
|
|
|
|
id: "import-secrets"
|
2025-01-08 11:50:14 +00:00
|
|
|
uses: "https://github.com/hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c" # v3
|
2025-01-07 05:58:42 +01:00
|
|
|
with:
|
2025-01-07 09:11:46 +01:00
|
|
|
url: "https://vault.w9r.dev"
|
|
|
|
method: "approle"
|
|
|
|
role: "forgejo-ci"
|
|
|
|
roleId: "${{ inputs.roleid }}"
|
|
|
|
secretId: "${{ inputs.secretid }}"
|
2025-01-07 05:58:42 +01:00
|
|
|
secrets: |
|
2025-01-08 05:51:15 +01:00
|
|
|
kv/data/ci/nexus username | MAVEN_USERNAME ;
|
|
|
|
kv/data/ci/nexus password | MAVEN_CENTRAL_TOKEN ;
|
|
|
|
kv/data/ci/nexus username | JRELEASER_ARTIFACTORY_USERNAME ;
|
|
|
|
kv/data/ci/nexus password | JRELEASER_ARTIFACTORY_TOKEN ;
|
2025-01-07 05:58:42 +01:00
|
|
|
kv/data/ci/vulnz username | VULNZ_USERNAME ;
|
|
|
|
kv/data/ci/vulnz password | VULNZ_PASSWORD ;
|
2025-01-08 05:58:38 +01:00
|
|
|
kv/data/ci/releasebot gpgPrivateKey | JRELEASER_GPG_SECRET_KEY ;
|
2025-01-08 05:51:15 +01:00
|
|
|
kv/data/ci/releasebot gpgPublicKey | JRELEASER_GPG_PUBLIC_KEY ;
|
|
|
|
kv/data/ci/releasebot gpgPassphrase | JRELEASER_GPG_PASSPHRASE ;
|
2025-01-07 05:58:42 +01:00
|
|
|
kv/data/ci/releasebot ciToken | JRELEASER_GITEA_TOKEN ;
|
|
|
|
kv/data/ci/signing gpgPrivateKey | GPG_PRIVATE_KEY ;
|
|
|
|
kv/data/ci/signing gpgPublicKey | GPG_PUBLIC_KEY ;
|
2025-01-08 05:51:15 +01:00
|
|
|
kv/data/ci/signing gpgPassphrase | MAVEN_GPG_PASSPHRASE ;
|
|
|
|
kv/data/ci/sonarqube sonarToken | SONAR_TOKEN ;
|
|
|
|
kv/data/ci/sonarqube sonarHost | SONAR_HOST_URL ;
|
2025-01-07 05:58:42 +01:00
|
|
|
|
2025-01-07 09:11:46 +01:00
|
|
|
- name: "Set up Environment"
|
|
|
|
shell: "bash"
|
2025-01-07 05:58:42 +01:00
|
|
|
run: |
|
|
|
|
apt update
|
2025-01-07 12:47:27 +01:00
|
|
|
apt install -y zip zstd
|
2025-01-07 05:58:42 +01:00
|
|
|
mkdir -p /root/.jreleaser
|
|
|
|
mkdir -p /root/.m2
|
|
|
|
touch /root/.jreleaser/config.properties
|
|
|
|
|
2025-01-07 09:11:46 +01:00
|
|
|
- name: "Install syft"
|
2025-01-08 11:50:14 +00:00
|
|
|
uses: "https://github.com/anchore/sbom-action/download-syft@df80a981bc6edbc4e220a492d3cbe9f5547a6e75" # v0
|
2025-01-07 09:11:46 +01:00
|
|
|
id: "install_syft"
|
2025-01-07 05:58:42 +01:00
|
|
|
with:
|
2025-01-07 09:11:46 +01:00
|
|
|
syft-version: "v1.18.1"
|
2025-01-07 05:58:42 +01:00
|
|
|
|
2025-01-07 12:26:44 +01:00
|
|
|
- name: "Setup Java and Maven"
|
2025-01-08 11:50:14 +00:00
|
|
|
uses: "https://github.com/s4u/setup-maven-action@4f7fb9d9675e899ca81c6161dadbba0189a4ebb1" # v1.18.0
|
2025-01-07 05:58:42 +01:00
|
|
|
with:
|
2025-01-07 12:26:44 +01:00
|
|
|
checkout-fetch-depth: 0
|
|
|
|
java-distribution: "temurin"
|
|
|
|
java-version: 21
|
|
|
|
maven-version: 3.9.9
|
|
|
|
settings-repositories: >
|
2025-01-07 05:58:42 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "maven-releases",
|
|
|
|
"name": "Releases",
|
|
|
|
"url": "https://nexus.w9r.dev/repository/maven-releases",
|
|
|
|
"releases": {
|
|
|
|
"enabled": "true",
|
|
|
|
"updatePolicy": "always",
|
|
|
|
"checksumPolicy": "warn"
|
|
|
|
},
|
|
|
|
"snapshots": {
|
|
|
|
"enabled": "false",
|
|
|
|
"updatePolicy": "always",
|
|
|
|
"checksumPolicy": "fail"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "maven-snapshots",
|
|
|
|
"name": "Snapshots",
|
|
|
|
"url": "https://nexus.w9r.dev/repository/maven-snapshots",
|
|
|
|
"releases": {
|
|
|
|
"enabled": "false",
|
|
|
|
"updatePolicy": "always",
|
|
|
|
"checksumPolicy": "warn"
|
|
|
|
},
|
|
|
|
"snapshots": {
|
|
|
|
"enabled": "true",
|
|
|
|
"updatePolicy": "always",
|
|
|
|
"checksumPolicy": "warn"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2025-01-07 12:26:44 +01:00
|
|
|
settings-servers: >
|
2025-01-07 05:58:42 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "maven-group",
|
2025-01-08 05:51:15 +01:00
|
|
|
"username": "${{ env.MAVEN_USERNAME }}",
|
|
|
|
"password": "${{ env.MAVEN_CENTRAL_TOKEN }}"
|
2025-01-07 05:58:42 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "maven-snapshots",
|
2025-01-08 05:51:15 +01:00
|
|
|
"username": "${{ env.MAVEN_USERNAME }}",
|
|
|
|
"password": "${{ env.MAVEN_CENTRAL_TOKEN }}"
|
2025-01-07 05:58:42 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "maven-releases",
|
2025-01-08 05:51:15 +01:00
|
|
|
"username": "${{ env.MAVEN_USERNAME }}",
|
|
|
|
"password": "${{ env.MAVEN_CENTRAL_TOKEN }}"
|
2025-01-07 05:58:42 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "vulnz",
|
|
|
|
"username": "${{ env.VULNZ_USERNAME }}",
|
|
|
|
"password": "${{ env.VULNZ_PASSWORD }}"
|
|
|
|
}
|
|
|
|
]
|
2025-01-07 12:26:44 +01:00
|
|
|
settings-mirrors: >
|
2025-01-07 05:58:42 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "maven-group",
|
|
|
|
"name": "central",
|
|
|
|
"mirrorOf": "*",
|
|
|
|
"url": "https://nexus.w9r.dev/repository/maven-group/"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2025-01-07 09:11:46 +01:00
|
|
|
- name: "Import Commit Signing GPG key"
|
|
|
|
id: "import-gpg"
|
2025-01-08 11:50:14 +00:00
|
|
|
uses: "https://github.com/crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5" # v6
|
2025-01-07 05:58:42 +01:00
|
|
|
with:
|
2025-01-08 05:58:38 +01:00
|
|
|
gpg_private_key: "${{ env.JRELEASER_GPG_SECRET_KEY }}"
|
2025-01-08 05:51:15 +01:00
|
|
|
passphrase: "${{ env.JRELEASER_GPG_PASSPHRASE }}"
|
2025-01-07 05:58:42 +01:00
|
|
|
git_user_signingkey: true
|
|
|
|
git_commit_gpgsign: true
|
|
|
|
|
2025-01-07 09:11:46 +01:00
|
|
|
- name: "GPG user IDs"
|
|
|
|
shell: "bash"
|
2025-01-07 05:58:42 +01:00
|
|
|
run: |
|
|
|
|
echo "fingerprint: ${{ steps.import-gpg.outputs.fingerprint }}"
|
|
|
|
echo "keyid: ${{ steps.import-gpg.outputs.keyid }}"
|
|
|
|
echo "name: ${{ steps.import-gpg.outputs.name }}"
|
|
|
|
echo "email: ${{ steps.import-gpg.outputs.email }}"
|