100 lines
3.4 KiB
YAML
100 lines
3.4 KiB
YAML
name: Build and Push Distroless Flood
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '17 9 * * 1'
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
flood_version:
|
|
description: 'jesec/flood release tag, or auto to check for a new stable release'
|
|
required: true
|
|
default: 'auto'
|
|
type: string
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: kube
|
|
if: ((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.schedule != '') && github.ref == 'refs/heads/main') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
|
outputs:
|
|
version: ${{ steps.release.outputs.version }}
|
|
should_build: ${{ steps.release.outputs.should_build }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Select Flood release
|
|
id: release
|
|
env:
|
|
SOURCE_REF: ${{ github.ref }}
|
|
FLOOD_VERSION: ${{ github.event.inputs.flood_version }}
|
|
run: node build/check-release.cjs
|
|
|
|
build:
|
|
needs: release
|
|
if: needs.release.outputs.should_build == 'true'
|
|
runs-on: kube
|
|
env:
|
|
DOCKER_BUILD_RECORD_UPLOAD: 'false'
|
|
DOCKER_BUILD_SUMMARY: 'false'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Fetch Flood release
|
|
env:
|
|
FLOOD_VERSION: ${{ needs.release.outputs.version }}
|
|
run: |
|
|
test -n "$FLOOD_VERSION" || { echo "flood_version is required" >&2; exit 1; }
|
|
git check-ref-format "refs/tags/$FLOOD_VERSION"
|
|
git init flood-repo
|
|
git -C flood-repo fetch --depth=1 https://github.com/jesec/flood.git "refs/tags/$FLOOD_VERSION"
|
|
git -C flood-repo checkout --detach FETCH_HEAD
|
|
cp Dockerfile.client flood-repo/Dockerfile.client
|
|
cp build/runtime-root.py flood-repo/.ci-runtime-root.py
|
|
cp tests/startup.cjs flood-repo/.ci-startup.cjs
|
|
printf '\n.git\n.github\n.env\n' >> flood-repo/.dockerignore
|
|
|
|
- name: Install Docker CLI
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends docker.io
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Set up temporary builder
|
|
uses: https://github.com/docker/setup-buildx-action@v3
|
|
with:
|
|
driver: docker-container
|
|
cache-binary: false
|
|
keep-state: false
|
|
cleanup: true
|
|
|
|
- name: Build and push to Docker Hub
|
|
uses: https://github.com/docker/build-push-action@v6
|
|
with:
|
|
context: ./flood-repo
|
|
file: ./flood-repo/Dockerfile.client
|
|
platforms: linux/amd64
|
|
pull: true
|
|
push: true
|
|
load: false
|
|
tags: |
|
|
docker.io/k2patel/floodui:latest
|
|
docker.io/k2patel/floodui:${{ needs.release.outputs.version }}
|
|
labels: |
|
|
org.opencontainers.image.source=https://git.k2patel.in/k2patel/docker-flood-client
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
org.opencontainers.image.version=${{ needs.release.outputs.version }}
|