This is a Github action to add a root certificate in x509 format to the default java truststore
Go to file
2024-09-08 22:01:10 +02:00
.gitignore Initial commit 2024-08-25 18:58:28 +02:00
action.yml feature: add debug option 2024-09-05 22:32:59 +02:00
LICENSE Initial commit 2024-08-25 18:58:28 +02:00
README.md doc: change usage example with migration to self hosted gitea 2024-09-08 22:01:10 +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: https://antoine-roux.tk/projects/actions/get-ca-cert@v1.1.0

      - 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: https://antoine-roux.tk/projects/actions/add-ca-truststore@v1.2.0
        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