Skip to content

feat(fw): self-upgrade from GitHub releases (endpoint + dashboard but… #367

feat(fw): self-upgrade from GitHub releases (endpoint + dashboard but…

feat(fw): self-upgrade from GitHub releases (endpoint + dashboard but… #367

Workflow file for this run

name: Build and Push Docker Images
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
docker:
description: 'Docker image to build'
required: false
default: 'all'
type: choice
options:
- all
- lnvps-api
- lnvps-api-admin
- lnvps-operator
- lnvps-nostr
- lnvps-host-info
env:
REGISTRY: registry.v0l.io
HOST_INFO_IMAGE: registry.v0l.io/lnvps-host-info
jobs:
# Build host-info as a multi-arch image first
build-host-info:
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.docker == 'lnvps-host-info' || github.event.inputs.docker == 'all'))
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: registry
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push lnvps-host-info
uses: docker/build-push-action@v5
with:
context: lnvps_host_util
file: lnvps_host_util/Dockerfile
platforms: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
tags: ${{ env.HOST_INFO_IMAGE }}:latest
cache-from: type=gha,scope=host-info
cache-to: type=gha,mode=max,scope=host-info
# Build main images after host-info is ready
build:
runs-on: ubuntu-latest
needs: build-host-info
if: >
always() && (
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'workflow_dispatch'
)
strategy:
fail-fast: false
matrix:
include:
- name: lnvps-api
file: lnvps_api/Dockerfile
image: registry.v0l.io/lnvps-api:latest
- name: lnvps-api-admin
file: lnvps_api_admin/Dockerfile
image: registry.v0l.io/lnvps-api-admin:latest
- name: lnvps-operator
file: lnvps_operator/Dockerfile
image: registry.v0l.io/lnvps-operator:latest
- name: lnvps-nostr
file: lnvps_nostr/Dockerfile
image: registry.v0l.io/lnvps-nostr:latest
- name: lnvps-agent
file: lnvps_agent/Dockerfile
image: registry.v0l.io/lnvps-agent:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: registry
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push ${{ matrix.name }}
if: >
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.docker == matrix.name || github.event.inputs.docker == 'all'))
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.file }}
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
tags: ${{ matrix.image }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
build-args: |
HOST_INFO_IMAGE=${{ env.HOST_INFO_IMAGE }}:latest
REGISTRY_USER=registry
REGISTRY_PASS=${{ secrets.REGISTRY_TOKEN }}