+x on s6 files #665
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: Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
reason: | |
required: true | |
description: 'Reason for running this workflow' | |
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 }} | |
run: | | |
echo "Workflow dispatch reason: $INPUTS_REASON" | |
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 | |
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_and_healthcheck: | |
name: Deploy with telegraf and healthcheck | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.GH_LABEL }} | |
# Log into ghcr (so we can push images) | |
- name: Login to ghcr.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.GHCR_REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: image=moby/buildkit:v0.10.6 | |
# ensure that the Dockerfile include telegraf | |
- name: Enable telegraf in Dockerfile | |
run: | | |
sed -i "s/##telegraf##//g" ./Dockerfile | |
# Build "telegraf" (with healthcheck) | |
- name: Build & Push - telegraf | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
tags: ghcr.io/${{ env.GHCR_IMAGE }}:${{ env.GHCR_TAG }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy_with_telegraf_and_nohealthcheck: | |
name: Deploy with telegraf and nohealthcheck | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.GH_LABEL }} | |
# Log into ghcr (so we can push images) | |
- name: Login to ghcr.io | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.GHCR_REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: image=moby/buildkit:v0.10.6 | |
# ensure that the Dockerfile include telegraf | |
# comment out HEALTHCHECK from dockerfile to build a telegraf_nohealthcheck label | |
- name: Enable telegraf in Dockerfile | |
run: | | |
sed -i "s/##telegraf##//g" ./Dockerfile | |
sed -i "s/\(^\s*HEALTHCHECK.*\)/#\1/g" ./Dockerfile | |
# Build "telegraf_nohealthcheck" | |
- name: Build & Push - telegraf_nohealthcheck | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
tags: ghcr.io/${{ env.GHCR_IMAGE }}:${{ env.GHCR_TAG }}_nohealthcheck | |
labels: ${{ steps.meta.outputs.labels }} | |
trigger_build_sdr-enthusiasts_ultrafeeder: | |
name: Trigger deploy of sdr-enthusiasts/docker-adsb-ultrafeeder | |
needs: ['deploy', 'deploy_with_telegraf_and_healthcheck', 'deploy_with_telegraf_and_nohealthcheck'] | |
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" | |
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" |