Files
steampipe/.github/workflows/publish_docker.yml

83 lines
2.4 KiB
YAML

name: Publish Docker Release and Update Brew
on:
workflow_dispatch:
inputs:
release:
description: "The name of the released version to publish"
required: true
env:
STEAMPIPE_VERSION: ${{ github.event.inputs.release }}
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
jobs:
publish_docker:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Clean Version for Tag
id: generate_docker_tag
run: |
echo "::set-output name=docker_tag::${STEAMPIPE_VERSION#"v"}"
- name: Build and Push to Docker Hub
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
build-args: |
TARGETOS=linux
TARGETARCH=amd64
TARGETVERSION=${{ env.STEAMPIPE_VERSION }}
tags: |
turbot/steampipe:${{ steps.generate_docker_tag.outputs.docker_tag }}
turbot/steampipe:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
update_homebrew_tap:
name: Update homebrew-tap formula
needs: publish_docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: turbot/homebrew-tap
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: main
- name: Get pull request title
id: pr_title
run: >-
echo "::set-output name=PR_TITLE::$(
gh pr view $STEAMPIPE_VERSION --json title | jq .title | tr -d '"'
)"
- name: Output
run: |
echo ${{ steps.pr_title.outputs.PR_TITLE }}
echo ${{ env.STEAMPIPE_VERSION }}
- name: Fail if PR title does not match with version
run: |
if ${{ (steps.pr_title.outputs.PR_TITLE == env.STEAMPIPE_VERSION) }} == 'true';then
echo "Correct version"
else
echo "Incorrect version"
exit 1
fi
- name: Merge pull request to update brew formula
run: |
git fetch --all
gh pr merge $STEAMPIPE_VERSION --squash --delete-branch
git push origin --delete bump-brew