feature: create action to setup-java and add root ca
This commit is contained in:
parent
d22e935823
commit
87b59927a5
35
README.md
35
README.md
@ -1,2 +1,33 @@
|
||||
# action-template
|
||||
github action template
|
||||
# setup-java
|
||||
|
||||
GitHub action to setup and configure java.
|
||||
The aim is to abstract [public setup-java action](https://github.com/actions/setup-java)
|
||||
to allow homemade customization, for example adding root ca certificate to the java truststore
|
||||
|
||||
## Usage example
|
||||
|
||||
```shell
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: "contains(github.event.head_commit.message, vars.SKIP_CI_PREFIX) != true"
|
||||
|
||||
runs-on: runner
|
||||
steps:
|
||||
- uses: RouxAntoine/checkout@v3.5.4
|
||||
|
||||
- uses: antoine-roux.tk/projects/actions/setup-java@v1.0.0
|
||||
|
||||
- uses: RouxAntoine/auto-changie@v1.0.1
|
||||
|
||||
- name: Push changelog
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "${{ vars.SKIP_CI_PREFIX }} Push updated changelog"
|
||||
```
|
||||
|
56
action.yml
56
action.yml
@ -1,33 +1,39 @@
|
||||
name: 'Action-template'
|
||||
description: 'Github action template'
|
||||
name: 'setup-java'
|
||||
description: |
|
||||
Github action to setup java and adding custom root certificate in the truststore
|
||||
see more information in official setup-java action
|
||||
https://github.com/actions/setup-java
|
||||
branding:
|
||||
icon: file
|
||||
color: orange
|
||||
icon: zap
|
||||
color: gray-dark
|
||||
inputs:
|
||||
sample-input:
|
||||
description: 'input example'
|
||||
default: 'default-value'
|
||||
version:
|
||||
description: 'java version to setup'
|
||||
default: '21'
|
||||
required: false
|
||||
distribution:
|
||||
description: 'java distribution to setup'
|
||||
default: 'temurin'
|
||||
required: false
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set GitHub Path example
|
||||
run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_ACTION_PATH: ${{ github.action_path }}
|
||||
- name: Retrieve root ca certificate
|
||||
id: get-ca-cert
|
||||
uses: RouxAntoine/get-ca-cert@v1.0.0
|
||||
|
||||
- name: Set Github secret output result example
|
||||
id: sets-a-secret
|
||||
shell: bash
|
||||
run: |
|
||||
the_secret=$((RANDOM))
|
||||
echo "::add-mask::$the_secret"
|
||||
echo "secret-number=$the_secret" >> "$GITHUB_OUTPUT"
|
||||
- name: Setup java ${{ inputs.distribution }} version ${{ inputs.version }}
|
||||
uses: actions/setup-java@v4
|
||||
id: java
|
||||
with:
|
||||
distribution: "${{ inputs.distribution }}"
|
||||
java-version: "${{ inputs.version }}"
|
||||
overwrite-settings: false
|
||||
|
||||
- name: Set Github output result example
|
||||
id: sets-output
|
||||
shell: bash
|
||||
run: |
|
||||
output_number=$((RANDOM))
|
||||
echo "output-number=$output_number" >> "$GITHUB_OUTPUT"
|
||||
- name: Add root certificate to java truststore
|
||||
uses: RouxAntoine/add-ca-truststore@v1.1.0
|
||||
id: add-ca-to-truststore
|
||||
with:
|
||||
alias-name: antoine-roux.tk
|
||||
ca-cert: "${{ steps.get-ca-cert.outputs.ca-cert }}"
|
||||
store-path: "${{ steps.java.outputs.path }}/lib/security/cacerts"
|
||||
|
Loading…
Reference in New Issue
Block a user