Skip to content

Update branch references from 'master' to 'main' in CI workflow and D… #32

Update branch references from 'master' to 'main' in CI workflow and D…

Update branch references from 'master' to 'main' in CI workflow and D… #32

Workflow file for this run

name: Lua Docker - Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lua-version: ['5.1.4', '5.2.3', '5.3.4', '5.4.7']
luarocks-version: ['3.11.1']
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure Docker BuildKit
run: |
echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version components
id: version
run: |
FULL_VERSION=${{ matrix.lua-version }}
MAJOR_VERSION=$(echo $FULL_VERSION | cut -d'.' -f1)
MAJOR_MINOR_VERSION=$(echo $FULL_VERSION | cut -d'.' -f1,2)
echo "full_version=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
echo "major_minor_version=$MAJOR_MINOR_VERSION" >> $GITHUB_OUTPUT
- name: Install Syft for SBOM generation
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
evandarwin/lua:${{ steps.version.outputs.full_version }}
evandarwin/lua:${{ steps.version.outputs.major_minor_version }}
evandarwin/lua:${{ steps.version.outputs.major_version }}
${{ matrix.lua-version == '5.4.7' && 'evandarwin/lua:latest' || '' }}
provenance: true
outputs: type=image,name=evandarwin/lua:${{ steps.version.outputs.full_version }}
build-args: |
BUILD_DATE=${{ github.event.repository.updated_at }}
VCS_REF=${{ github.sha }}
LUA_VERSION=${{ matrix.lua-version }}
LUAROCKS_VERSION=${{ matrix.luarocks-version }}
- name: Generate SBOM
if: github.event_name != 'pull_request'
run: |
# Create output directory
mkdir -p sbom
# Generate SBOM in multiple formats
syft evandarwin/lua:${{ steps.version.outputs.full_version }} -o spdx-json=sbom/spdx.json
syft evandarwin/lua:${{ steps.version.outputs.full_version }} -o cyclonedx-json=sbom/cyclonedx.json
# Optional: Generate human-readable text version
syft evandarwin/lua:${{ steps.version.outputs.full_version }} -o text=sbom/sbom.txt
- name: Upload SBOM as artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: sbom-files-${{ matrix.lua-version }}
path: sbom/
retention-days: 90