2024-08-25 17:39:25 +00:00
|
|
|
# Add root certificate to java truststore
|
|
|
|
|
|
|
|
Github action to add a root certificate in x509 format to an existing java truststore.
|
|
|
|
|
|
|
|
usage example
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
name: Main
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: runner
|
|
|
|
steps:
|
|
|
|
- name: Retrieve root ca certificate
|
|
|
|
id: get-ca-cert
|
2024-09-08 20:01:10 +00:00
|
|
|
uses: https://antoine-roux.tk/projects/actions/get-ca-cert@v1.1.0
|
2024-08-25 17:39:25 +00:00
|
|
|
|
|
|
|
- run: |
|
|
|
|
echo "${{ steps.get-ca-cert.outputs.ca-cert }}"
|
|
|
|
|
|
|
|
- uses: actions/setup-java@v4
|
|
|
|
id: java
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '21'
|
|
|
|
|
|
|
|
- name: Add root certificate to java truststore
|
2024-09-08 20:01:10 +00:00
|
|
|
uses: https://antoine-roux.tk/projects/actions/add-ca-truststore@v1.2.0
|
2024-08-25 17:39:25 +00:00
|
|
|
id: add-ca-to-truststore
|
|
|
|
with:
|
|
|
|
ca-cert: "${{ steps.get-ca-cert.outputs.ca-cert }}"
|
|
|
|
store-path: "${{ steps.java.outputs.path }}/lib/security/cacerts"
|
|
|
|
|
|
|
|
- run: |
|
|
|
|
echo "Auto generated alias name: ${{ steps.add-ca-to-truststore.outputs.certificate-alias }}"
|
|
|
|
keytool -list -cacerts
|
|
|
|
```
|