Deploy #1004
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: | |
# Build and deploy the image on pushes to main branch | |
workflow_dispatch: | |
inputs: | |
reason: | |
required: true | |
description: "Reason for running this workflow" | |
use_test_image: | |
required: false | |
type: boolean | |
description: "Use base image testpr" | |
default: false | |
# push: | |
# branches: | |
# - main | |
# paths: | |
# - "acarshub-typescript/**" | |
# - "Dockerfile.acarshub" | |
# - "Dockerfile.acarshub-nextgen" | |
# - "rootfs/**" | |
# - ".github/workflows/deploy.yml" | |
# - "version" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
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" | |
acarshub_typescript: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get version | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Build ACARSHub typescript test | |
working-directory: ./acarshub-typescript | |
run: | | |
set -xe | |
npm install | |
sed -i 's/Pre-Release/ACARS Hub NextGen: ${{ env.VERSION }} Build ${{ github.run_number }}/' ./src/helpers/menu.ts | |
npm run build | |
mkdir -p ./webapp/static/images | |
mkdir -p ./webapp/static/js | |
mkdir -p ./webapp/static/sounds | |
mkdir -p ./webapp/templates | |
cp -r ./dist/static/images ./webapp/static/ | |
cp -r ./dist/static/sounds ./webapp/static/ | |
cp -r ./dist/static/js ./webapp/static/ | |
mv ./dist/static/index.html ./webapp/templates/ | |
tar cvfz webapp.tar.gz ./webapp | |
cp webapp.tar.gz ../webapp.tar.gz | |
- name: Save webapp.tar.gz | |
uses: actions/upload-artifact@v3 | |
with: | |
name: webapp | |
path: | | |
./webapp.tar.gz | |
deploy_ghcr_nextgen: | |
name: Deploy ACARS Hub Next Gen Base Image | |
runs-on: ubuntu-latest | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
Dockerfile.nextgen | |
.github/workflows/deploy.yml | |
- name: Login to ghcr.io | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-qemu-action@v3 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-buildx-action@v3 | |
# Change the dockerfile to use the test image if we've been triggered as a test | |
- name: Change dockerfile if under baseimage test | |
id: change_dockerfile | |
if: ${{ github.event.inputs.use_test_image == 'true' }} | |
run: | | |
sed -i "s/:python/:python-test-pr/g" Dockerfile.nextgen | |
- name: Set output tag | |
id: set-output | |
run: | | |
# if we're using the test image, set an env variable to ghcr.io/sdr-enthusiasts/docker-acarshub:nextgen-test-pr | |
if [ "${{ github.event.inputs.use_test_image == 'true' }}" = "true" ]; then | |
echo "dockertag=ghcr.io/sdr-enthusiasts/docker-acarshub:nextgen-test-pr" >> $GITHUB_ENV | |
else | |
echo "dockertag=ghcr.io/sdr-enthusiasts/docker-acarshub:nextgen" >> $GITHUB_ENV | |
fi | |
# Build & Push Dockerfile (only push if this action was NOT triggered by a PR) | |
- name: Build & Push ghcr.io/sdr-enthusiasts/docker-acarshub:nextgen | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.nextgen | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.dockertag }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy_ghcr_latest: | |
name: Deploy to latest to dockerhub | |
runs-on: ubuntu-latest | |
needs: [deploy_ghcr_nextgen, acarshub_typescript] | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
Dockerfile.nextgen | |
Dockerfile.acarshub | |
acarshub-typescript/** | |
rootfs/** | |
.github/workflows/deploy.yml | |
version-nextgen | |
- name: Download webapp | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: actions/download-artifact@v3 | |
with: | |
name: webapp | |
- name: Get version | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Create ACARS Hub Version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" > ./rootfs/version | |
- name: Create version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
rm ./rootfs/version | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" >> ./rootfs/acarshub-version | |
- name: Login to ghcr.io | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Change the dockerfile to use the test image if we've been triggered as a test | |
- name: Change dockerfile if under baseimage test | |
id: change_dockerfile | |
if: ${{ github.event.inputs.use_test_image == 'true' }} | |
run: | | |
sed -i "s/:nextgen/:nextgen-test-pr/g" Dockerfile.acarshub | |
- name: Set output tag | |
id: set-output | |
run: | | |
# if we're using the test image, set an env variable to ghcr.io/sdr-enthusiasts/docker-acarshub:nextgen-test-pr | |
if [ "${{ github.event.inputs.use_test_image == 'true' }}" = "true" ]; then | |
echo "dockertag=ghcr.io/sdr-enthusiasts/docker-acarshub:baseimage-test" >> $GITHUB_ENV | |
else | |
echo "dockertag=ghcr.io/sdr-enthusiasts/docker-acarshub:latest" >> $GITHUB_ENV | |
fi | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-qemu-action@v3 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-buildx-action@v3 | |
# Build & Push Dockerfile (only push if this action was NOT triggered by a PR) | |
- name: Build & Push ghcr.io/sdr-enthusiasts/docker-acarshub:latest | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.acarshub | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.dockertag }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy_ghcr_version_specific: | |
name: Deploy version to dockerhub | |
runs-on: ubuntu-latest | |
needs: [deploy_ghcr_nextgen, acarshub_typescript] | |
if: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
Dockerfile.nextgen | |
Dockerfile.acarshub | |
acarshub-typescript/** | |
rootfs/** | |
.github/deploy.yml | |
version | |
- name: Download webapp | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: actions/download-artifact@v3 | |
with: | |
name: webapp | |
- name: Get version | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Create ACARS Hub Version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" > ./rootfs/version | |
- name: Create version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
rm ./rootfs/version | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" >> ./rootfs/acarshub-version | |
- name: Login to ghcr.io | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-qemu-action@v3 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-buildx-action@v3 | |
# Build & Push Dockerfile (only push if this action was NOT triggered by a PR) | |
- name: Build & Push ghcr.io/sdr-enthusiasts/docker-acarshub:version specific | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.acarshub | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/sdr-enthusiasts/docker-acarshub:${{ env.VERSION }}Build${{ github.run_number }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy_ghcr_latest_no_healthcheck: | |
name: Deploy to latest/no healthcheck | |
runs-on: ubuntu-latest | |
needs: [deploy_ghcr_nextgen, acarshub_typescript] | |
if: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
Dockerfile.nextgen | |
Dockerfile.acarshub | |
acarshub-typescript/** | |
rootfs/** | |
.github/deploy.yml | |
version | |
- name: Download webapp | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: actions/download-artifact@v3 | |
with: | |
name: webapp | |
- name: Get version | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Create ACARS Hub Version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" > ./rootfs/version | |
- name: Create version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
rm ./rootfs/version | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" >> ./rootfs/acarshub-version | |
- name: Login to ghcr.io | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-qemu-action@v3 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-buildx-action@v3 | |
# Patch dockerfile to remove healthcheck | |
- name: Patch Dockerfile to remove healthcheck | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: sed '/^HEALTHCHECK /d' < Dockerfile.acarshub > Dockerfile.acarshub.nohealthcheck | |
# Build & Push Dockerfile (only push if this action was NOT triggered by a PR) | |
- name: Build & Push ghcr.io/sdr-enthusiasts/docker-acarshub:latest_nohealthcheck | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.acarshub.nohealthcheck | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/sdr-enthusiasts/docker-acarshub:latest_nohealthcheck | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy_ghcr_version_specific_no_healthcheck: | |
name: Deploy version specific no healthcheck to dockerhub | |
runs-on: ubuntu-latest | |
needs: [deploy_ghcr_nextgen, acarshub_typescript] | |
if: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} | |
outputs: | |
cleanupinfo: ${{ steps.set-output.outputs.do_release }} | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 2 | |
- name: Get specific changed files | |
id: changed-files-specific | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
Dockerfile.nextgen | |
Dockerfile.acarshub | |
acarshub-typescript/** | |
rootfs/** | |
.github/deploy.yml | |
version | |
- name: Download webapp | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: actions/download-artifact@v3 | |
with: | |
name: webapp | |
- name: Get version | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Create ACARS Hub Version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" > ./rootfs/version | |
- name: Create version file | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: | | |
rm ./rootfs/version | |
echo "${{ env.VERSION }} Build ${{ github.run_number }}" >> ./rootfs/acarshub-version | |
- name: Login to ghcr.io | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Get metadata from repo | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set up QEMU for multi-arch builds | |
- name: Set up QEMU | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-qemu-action@v3 | |
# Set up buildx for multi platform builds | |
- name: Set up Docker Buildx | |
id: buildx | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/setup-buildx-action@v3 | |
# Patch dockerfile to remove healthcheck | |
- name: Patch Dockerfile to remove healthcheck | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
run: sed '/^HEALTHCHECK /d' < Dockerfile.acarshub > Dockerfile.acarshub.nohealthcheck | |
# Build & Push Dockerfile (only push if this action was NOT triggered by a PR) | |
- name: Build & Push ghcr.io/sdr-enthusiasts/docker-acarshub:version_nohealthcheck | |
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.reason != '') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.acarshub.nohealthcheck | |
no-cache: true | |
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/sdr-enthusiasts/docker-acarshub:${{ env.VERSION }}Build${{ github.run_number }}_nohealthcheck | |
labels: ${{ steps.meta.outputs.labels }} | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} | |
needs: | |
- deploy_ghcr_nextgen | |
- acarshub_typescript | |
- deploy_ghcr_latest | |
- deploy_ghcr_version_specific | |
- deploy_ghcr_latest_no_healthcheck | |
- deploy_ghcr_version_specific_no_healthcheck | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Get version | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
echo "ACARS Hub Build: ${{ github.run_number }}" | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
body: "See Commits" | |
allowUpdates: true | |
commit: ${{ github.ref }} | |
name: ${{ env.VERSION }} Build ${{ github.run_number }} | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |