mirror of
https://github.com/turbot/steampipe.git
synced 2026-05-13 06:04:27 -04:00
78 lines
2.7 KiB
YAML
78 lines
2.7 KiB
YAML
name: Publish Docker Release (Pre-release)
|
|
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 }}
|
|
GH_PUBLISH_ACCESS_TOKEN: ${{ secrets.GH_PUBLISH_ACCESS_TOKEN }}
|
|
|
|
jobs:
|
|
check_pre_release:
|
|
name: Check if pre-release
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
is_pre_release: ${{ steps.pre_release_check.outputs.is_pre_release }}
|
|
steps:
|
|
- name: Check if pre-release
|
|
id: pre_release_check
|
|
run: |
|
|
if [[ "${{ github.event.inputs.release }}" =~ -alpha|-beta|-rc|-dev ]]; then
|
|
echo "is_pre_release=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "is_pre_release=false" >> $GITHUB_OUTPUT
|
|
echo "This is not a pre-release. Skipping Docker image publish. Run the 'Publish Docker Release and Update Brew' workflow instead."
|
|
fi
|
|
|
|
publish_docker:
|
|
name: Push Docker image to Docker Hub
|
|
needs: check_pre_release
|
|
runs-on: ubuntu-latest
|
|
if: needs.check_pre_release.outputs.is_pre_release == 'true'
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# TODO: v0.21.x will be the last version we publish our images to Docker Hub. Update Docker
|
|
# publish workflow to stop publishing to Docker Hub just before v0.22.0 comes out.
|
|
# https://github.com/turbot/steampipe/issues/3327
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GH_PUBLISH_ACCESS_TOKEN }}
|
|
|
|
- name: Clean Version for Tag
|
|
id: generate_docker_tag
|
|
run: |
|
|
echo "docker_tag=${STEAMPIPE_VERSION#"v"}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and Push to DockerHub and Container Registry
|
|
id: docker_build
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
build-args: |
|
|
TARGETVERSION=${{ env.STEAMPIPE_VERSION }}
|
|
tags: |
|
|
turbot/steampipe:${{ steps.generate_docker_tag.outputs.docker_tag }}
|
|
ghcr.io/turbot/steampipe:${{ steps.generate_docker_tag.outputs.docker_tag }}
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|