Publish FDW Image #163
Workflow file for this run
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: 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: ghcr.io/turbot/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 | |
# Login to GHCR | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PUBLISH_ACCESS_TOKEN }} | |
- 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 | |
# Push to GHCR | |
- 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 |