Skip to content

Merge pull request #409 from cybwan/main #468

Merge pull request #409 from cybwan/main

Merge pull request #409 from cybwan/main #468

Workflow file for this run

name: Build-CI
on:
push:
branches: [ "main" ]
workflow_dispatch:
inputs:
tagName:
description: 'Tag Name'
required: true
default: 'latest'
jobs:
build:
name: build-ci
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the latest loxilb Docker image
if: github.event.inputs.tagName == ''
run: docker build . --tag ghcr.io/loxilb-io/loxilb:latest
- name: Build the loxilb Docker image with given tag
if: github.event.inputs.tagName != ''
run: docker build . --tag ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
- name: Run the loxilb docker image to check
run: docker run -u root --cap-add SYS_ADMIN --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest
- name: Publish the latest loxilb Docker image
if: |
github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName == ''
run: docker push ghcr.io/loxilb-io/loxilb:latest
- name: Publish the loxilb Docker image with given tag
if: |
github.repository == 'loxilb-io/loxilb'
&& github.event.inputs.tagName != ''
run: docker push ghcr.io/loxilb-io/loxilb:${{ github.event.inputs.tagName }}
# This is currently not supported yet for docker packages
- name: Cleanup old Docker packages
uses: actions/delete-package-versions@v3
with:
package-name: 'loxilb'
num-old-versions-to-delete: 3