Docker-Runit/.github/workflows/marshall.yml

74 lines
2.3 KiB
YAML

name: Build Marshall
on:
push:
paths:
- 'marshall/**'
pull_request:
branches:
- '!dependabot/**'
workflow_run:
workflows:
- Lint Docker Files
branches: [ 'master', 'feature/**' ]
types:
- completed
workflow_dispatch:
jobs:
marshall-build:
name: "Build Marshall"
runs-on: ubuntu-latest
steps:
- name: "Build: Prepare Environment Variables"
id: environment
run: |
{
echo "datetime=$(date +'%Y-%m-%d %H:%M:%S')"
echo "date=$(date +'%Y-%m-%d')"
echo "time=$(date +'%H:%M:%S')"
echo "container_build_datetime=$(date -u +'%Y-%m-%dT%H:%M:%S.%3NZ')"
echo "marshall_version=$(git rev-parse --short HEAD)"
echo "marshall_build_date=$(date '+%Y-%m-%d %H:%M:%S')"
echo "marshall_build_host=$(hostname)"
} >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
sparse-checkout: |
marshall
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: "Setup: Login to Docker Hub"
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: "Setup: Login to GHCR"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PASSWORD }}
- uses: docker/build-push-action@v5
name: Build & Push
with:
context: marshall
platforms: ${{ !env.ACT && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
pull: true
push: ${{ !env.ACT && true || false }}
tags: |
ghcr.io/benzine-framework/marshall:latest
benzine/marshall:latest
build-args: |
MARSHALL_VERSION=${{ steps.environment.outputs.marshall_version }}
MARSHALL_BUILD_DATE=${{ steps.environment.outputs.marshall_build_date }}
MARSHALL_BUILD_HOST=${{ steps.environment.outputs.marshall_build_host }}
cache-from: ${{ !env.ACT && 'type=gha' || 'type=local,src=.github/cache' }}
cache-to: ${{ !env.ACT && 'type=gha,mode=max' || 'type=local,dest=.github/cache' }}