Build & Release Providers #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build & Release Providers' | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Providers that should be released" | |
default: "arista aws azure equinix gcp github gitlab google-workspace ipmi k8s ms365 network oci okta opcua os slack terraform vcd vsphere" | |
env: | |
BUCKET: releases-us.mondoo.io | |
PROVIDERS: "os network" | |
jobs: | |
build: | |
runs-on: self-hosted | |
timeout-minutes: 30 | |
steps: | |
- name: Version from Workflow Dispatch | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "PROVIDERS=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ">=1.21.0" | |
cache: false | |
- name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.GCP_RELEASE_SERVICE_ACCOUNT}} | |
- name: 'Set up gcloud CLI' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: 'Build dependencies' | |
run: | | |
make providers/proto | |
go build -o lr ./providers-sdk/v1/lr/cli/main.go | |
- name: 'Build Providers' | |
run: | | |
rm -rf ./dist | |
for p in ${PROVIDERS}; do | |
scripts/provider_bundler.sh $p | |
done | |
- name: 'Publish Providers' | |
run: | | |
for pkg in $(ls dist | cut -f1,2 -d_ | uniq); do | |
echo "Publishing $pkg" | |
PROVIDER=$(echo $pkg | cut -f1 -d_) | |
VERSION=$(echo $pkg | cut -f2 -d_) | |
echo "Publishing $pkg to gs://${BUCKET}/providers/${PROVIDER}/${VERSION}/" | |
gsutil -m cp -c dist/${pkg}*.xz gs://${BUCKET}/providers/${PROVIDER}/${VERSION}/ | |
gsutil -m cp -c dist/${pkg}_SHA256SUMS gs://${BUCKET}/providers/${PROVIDER}/${VERSION}/ | |
echo "{ \"name\": \"${PROVIDER}\", \"version\": \"${VERSION}\" }" >> "dist/${pkg}.json" | |
done | |
- name: 'Publish latest.json' | |
run: | | |
echo "{ \"providers\": [$(ls dist/*.json | xargs cat | paste -sd, -)] }" > dist/latest.json | |
gsutil -m cp -c dist/latest.json gs://${BUCKET}/providers/ | |
- name: Trigger Reindex of releases.mondoo.com | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.RELEASR_ACTION_TOKEN }} | |
repository: "mondoohq/releasr" | |
event-type: reindex | |
client-payload: '{ }' |