Skip to content

Publish FDW Image

Publish FDW Image #157

Workflow file for this run

name: Publish FDW Image
on:
workflow_dispatch:
inputs:
release:
description: "The published release to package as an image(must be prefixed with 'v')"
required: true
env:
PROJECT_ID: steampipe
IMAGE_NAME: fdw
CORE_REPO: us-docker.pkg.dev/steampipe/steampipe
ORG: turbot
CONFIG_SCHEMA_VERSION: "2020-11-18"
VERSION: ${{ github.event.inputs.release }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Get Release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
gh release download ${{ github.event.inputs.release }} --dir . --repo ${{ github.repository }}
- name: Release assets downloaded
run: |-
ls -la .
- name: Sanitize Version
run: |-
echo $VERSION
trim=${VERSION#"v"}
echo $trim
echo "VERSION=${trim}" >> $GITHUB_ENV
- name: Validate Version
run: |-
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "Version OK: $VERSION"
else
echo "Invalid version: $VERSION"
exit 1
fi
- name: Authenticate GCloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.STEAMPIPE_REGISTRY_SA_KEY }}
- name: Configure GCloud CLI project
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ env.PROJECT_ID }}
- name: Setup GCloud CLI
run: |-
gcloud config list
gcloud components install beta
gcloud components install alpha --quiet
gcloud beta auth configure-docker us-docker.pkg.dev
- name: Verify ORAS installations
run: oras version
- name: Create Config JSON
run: |-
JSON_STRING=$( jq -n \
--arg name "$IMAGE_NAME" \
--arg organization "$ORG" \
--arg version "$VERSION" \
--arg schemaVersion "$CONFIG_SCHEMA_VERSION" \
'{schemaVersion: $schemaVersion, fdw: { name: $name, organization: $organization, version: $version} }' )
echo $JSON_STRING > config.json
cat config.json
- name: Create Annotations JSON
run: |-
JSON_STRING=$( jq -n \
--arg title "$IMAGE_NAME" \
--arg desc "$ORG" \
--arg version "$VERSION" \
--arg timestamp "$(date +%FT%TZ)" \
--arg vendor "Turbot HQ, Inc." \
'{
"$manifest": {
"org.opencontainers.image.title": $title,
"org.opencontainers.image.description": $desc,
"org.opencontainers.image.version": $version,
"org.opencontainers.image.created": $timestamp,
"org.opencontainers.image.vendor": $vendor
}
}' )
echo $JSON_STRING > annotations.json
cat annotations.json
- name: Push to registry
run: |-
REF="$CORE_REPO/$IMAGE_NAME:$VERSION"
oras push $REF \
--config config.json:application/vnd.turbot.steampipe.config.v1+json \
--annotation-file annotations.json \
steampipe_postgres_fdw.so.darwin_amd64.gz:application/vnd.turbot.steampipe.fdw.darwin-amd64.layer.v1+gzip \
steampipe_postgres_fdw.so.linux_amd64.gz:application/vnd.turbot.steampipe.fdw.linux-amd64.layer.v1+gzip \
steampipe_postgres_fdw.so.darwin_arm64.gz:application/vnd.turbot.steampipe.fdw.darwin-arm64.layer.v1+gzip \
steampipe_postgres_fdw.so.linux_arm64.gz:application/vnd.turbot.steampipe.fdw.linux-arm64.layer.v1+gzip \
steampipe_postgres_fdw.control:application/vnd.turbot.steampipe.fdw.control.layer.v1+text \
steampipe_postgres_fdw--1.0.sql:application/vnd.turbot.steampipe.fdw.sql.layer.v1+text