Build and publish a steampipe and powerpipe images to ghcr.io #105
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 and publish a steampipe and powerpipe images to ghcr.io | |
on: | |
# publish on releases, e.g. v2.1.13 (image tagged as "2.1.13" - "v" prefix is removed) | |
# release: | |
# types: [ published ] | |
push: | |
tags: | |
- "v*.*.*" | |
schedule: | |
# This cron expression runs at 00:00 (midnight) every Monday | |
- cron: '0 0 * * 1' | |
env: | |
REGISTRY: ghcr.io | |
STEAMPIPE_IMAGE_NAME: ${{ github.repository }}--steampipe | |
POWERPIPE_IMAGE_NAME: ${{ github.repository }}--powerpipe | |
jobs: | |
build-and-push-steampipe-and-powerpipe-docker-images: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Install jq | |
run: | | |
sudo snap install jq | |
- name: Extract metadata (tags, labels) for Docker | |
id: steampipemeta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.STEAMPIPE_IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
- name: Find Latest Steampipe Release | |
id: latest_steampipe_release | |
run: | | |
STEAMPIPE_AMD64_URL=$(curl -s https://api.github.com/repos/turbot/steampipe/releases/latest | jq -r '.assets[] | select(.name == "steampipe_linux_amd64.tar.gz") | .browser_download_url') | |
echo "STEAMPIPE_AMD64_URL=$STEAMPIPE_AMD64_URL" | |
echo "download_url=$STEAMPIPE_AMD64_URL" >> $GITHUB_OUTPUT | |
- name: Build and push Docker image -- steampipe | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./steampipe | |
push: true | |
tags: ${{ steps.steampipemeta.outputs.tags }} | |
labels: ${{ steps.steampipemeta.outputs.labels }} | |
file: ./steampipe/Dockerfile | |
build-args: STEAMPIPE_BINARY_DOWNLOAD_URL=${{ steps.latest_steampipe_release.outputs.download_url}} | |
- name: Find Latest Powerpipe Release | |
id: latest_powerpipe_release | |
run: | | |
POWERPIPE_AMD64_URL=$(curl -s https://api.github.com/repos/turbot/powerpipe/releases/latest | jq -r '.assets[] | select(.name == "powerpipe.linux.amd64.tar.gz") | .browser_download_url') | |
echo "POWERPIPE_AMD64_URL=$POWERPIPE_AMD64_URL" | |
echo "download_url=$POWERPIPE_AMD64_URL" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: powerpipemeta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.POWERPIPE_IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
- name: Build and push Docker image -- powerpipe | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./powerpipe | |
push: true | |
tags: ${{ steps.powerpipemeta.outputs.tags }} | |
labels: ${{ steps.powerpipemeta.outputs.labels }} | |
file: ./powerpipe/Dockerfile | |
build-args: POWERPIPE_BINARY_DOWNLOAD_URL=${{ steps.latest_powerpipe_release.outputs.download_url}} |