Skip to content

Publish SDK Artifacts #44

Publish SDK Artifacts

Publish SDK Artifacts #44

# Checks out the tag, builds release builds, and attaches them to the release for the tag.
# If you need to change build scripts, then update the tag to include the modifications.
# NOTE: This workflow uses sdk-release/action.yml @ the tag specified in the workflow_dispatch input.
on:
workflow_dispatch:
inputs:
tag:
description: 'The tag to create release artifacts for.'
required: true
sdk_target:
description: 'The library/cmake target to release (delimited by ":").'
required: true
default: 'libs/client-sdk:launchdarkly-cpp-client'
type: choice
options:
- libs/client-sdk:launchdarkly-cpp-client
- libs/server-sdk:launchdarkly-cpp-server
- libs/server-sdk-redis-source:launchdarkly-cpp-server-redis-source
name: Publish SDK Artifacts
jobs:
split-input:
runs-on: ubuntu-latest
outputs:
sdk_path: ${{ steps.split-string.outputs.SDK_PATH }}
sdk_cmake_target: ${{ steps.split-string.outputs.SDK_CMAKE_TARGET }}
steps:
- name: Determine CMake target and SDK library path
id: split-string
run: |
INPUT="${{ inputs.sdk_target }}"
IFS=':' read -ra PATH_AND_TARGET <<< "$INPUT"
echo "SDK_PATH=${PATH_AND_TARGET[0]}" >> $GITHUB_OUTPUT
echo "SDK_CMAKE_TARGET=${PATH_AND_TARGET[1]}" >> $GITHUB_OUTPUT
release-sdk:
needs: split-input
strategy:
matrix:
# Each of the platforms for which release-artifacts need generated.
os: [ ubuntu-latest, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
outputs:
hashes-linux: ${{ steps.release-sdk.outputs.hashes-linux }}
hashes-windows: ${{ steps.release-sdk.outputs.hashes-windows }}
hashes-macos: ${{ steps.release-sdk.outputs.hashes-macos }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
- id: release-sdk
name: Full release of ${{ needs.split-input.outputs.sdk_path }}
uses: ./.github/actions/sdk-release
with:
# The tag of the release to upload artifacts to.
tag_name: ${{ inputs.tag }}
github_token: ${{secrets.GITHUB_TOKEN}}
sdk_path: ${{ needs.split-input.outputs.sdk_path}}
sdk_cmake_target: ${{ needs.split-input.outputs.sdk_cmake_target}}
release-sdk-provenance:
needs: [ 'release-sdk' ]
strategy:
matrix:
# Generates a combined attestation for each platform
os: [ linux, windows, macos ]
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: "${{ needs.release-sdk.outputs[format('hashes-{0}', matrix.os)] }}"
upload-assets: true
upload-tag-name: ${{ inputs.tag }}
provenance-name: ${{ format('{0}-multiple-provenance.intoto.jsonl', matrix.os) }}