Skip to content

Deploy

Deploy #1073

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
inputs:
reason:
required: false
description: "Reason for running this workflow"
use_test_image:
required: false
type: boolean
description: "Use base image testpr"
default: false
push:
branches:
- main
# Trigger only on specific files being updated.
paths:
- Dockerfile
- rootfs/**
env:
GHCR_IMAGE: sdr-enthusiasts/docker-tar1090
GHCR_REGISTRY: ghcr.io
GH_LABEL: main
GHCR_TAG: telegraf
jobs:
workflow-dispatch:
name: Triggered via Workflow Dispatch?
# only run this step if workflow dispatch triggered
# log the reason the workflow dispatch was triggered
if: |
github.event_name == 'workflow_dispatch' &&
github.event.inputs.reason != ''
runs-on: ubuntu-latest
steps:
- name: Log dispatch reason
env:
INPUTS_REASON: ${{ github.event.inputs.reason }}
INPUTS_USE_TEST_IMAGE: ${{ github.event.inputs.use_test_image }}
run: |
echo "Workflow dispatch reason: $INPUTS_REASON"
echo "Use test image: $INPUTS_USE_TEST_IMAGE"
deploy:
name: Deploy without telegraf
uses: sdr-enthusiasts/common-github-workflows/.github/workflows/build_and_push_image.yml@main
with:
push_enabled: true
push_destinations: ghcr.io;dockerhub
ghcr_repo_owner: ${{ github.repository_owner }}
ghcr_repo: ${{ github.repository }}
dockerhub_profile: mikenye
dockerhub_repo: tar1090
get_version_method: git_commit_hash_short
# set build_latest to true if github.event.inputs.use_test_image is false
build_latest: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_baseimage_test: ${{ github.event.inputs.use_test_image == 'true' }}
# only build the entire stack if we are not using the test image
build_version_specific: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_platform_specific: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_nohealthcheck: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_baseimage_url: wreadsb/wreadsb-test-pr
secrets:
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
# unfortunately we can't use build_and_push_image.yml to build the telegraf label because
# that GH Action doesn't have the capability to build specific custom-named labels
deploy_with_telegraf:
name: Deploy with telegraf and healthcheck
uses: sdr-enthusiasts/common-github-workflows/.github/workflows/build_and_push_image.yml@main
with:
push_enabled: true
push_destinations: ghcr.io;dockerhub
ghcr_repo_owner: ${{ github.repository_owner }}
ghcr_repo: ${{ github.repository }}
dockerhub_profile: mikenye
dockerhub_repo: tar1090
get_version_method: git_commit_hash_short
# set build_latest to true if github.event.inputs.use_test_image is false
build_latest: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
build_baseimage_test: ${{ github.event.inputs.use_test_image == 'true' }}
build_baseimage_url: wreadsb/wreadsb-test-pr
# only build the entire stack if we are not using the test image
build_version_specific: false
build_platform_specific: false
build_nohealthcheck: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }}
docker_latest_tag: telegraf
dockerfile_changes: |
##telegraf##/
secrets:
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
trigger_build_sdr-enthusiasts_ultrafeeder:
name: Trigger deploy of sdr-enthusiasts/docker-adsb-ultrafeeder
needs: ["deploy", "deploy_with_telegraf"]
runs-on: ubuntu-latest
env:
WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_PAT_KX1T }}
WORKFLOW_REPO: sdr-enthusiasts/docker-adsb-ultrafeeder
WORKFLOW_FILE: deploy.yml
WORKFLOW_REASON: "triggered via deploy.yml in sdr-enthusiasts/docker-tar1090"
WORKFLOW_TEST_IMAGE: ${{ github.event.inputs.use_test_image }}
steps:
- name: Trigger ${{ env.WORKFLOW_FILE }} in ${{ env.WORKFLOW_REPO }}
run: |
echo "$WORKFLOW_AUTH_TOKEN" | gh auth login --with-token
gh workflow run --ref main --repo "$WORKFLOW_REPO" "$WORKFLOW_FILE" -f reason="$WORKFLOW_REASON" -f use_test_image="$WORKFLOW_TEST_IMAGE"