This is a Github action to add a root certificate in x509 format to the default java truststore
Go to file
2024-08-25 20:37:19 +02:00
.gitignore Initial commit 2024-08-25 18:58:28 +02:00
action.yml feature: protect ca addition from duplicate 2024-08-25 20:37:19 +02:00
LICENSE Initial commit 2024-08-25 18:58:28 +02:00
README.md feature: trust a root certificate in an existing java truststore 2024-08-25 19:39:25 +02:00

Add root certificate to java truststore

Github action to add a root certificate in x509 format to an existing java truststore.

usage example

name: Main

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: runner
    steps:
      - name: Retrieve root ca certificate
        id: get-ca-cert
        uses: RouxAntoine/get-ca-cert@master

      - 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
        uses: RouxAntoine/add-ca-truststore@master
        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