Files
opensimulator-docker/.github/workflows/build-source.yml
T
2026-04-03 17:47:03 +01:00

106 lines
3.0 KiB
YAML

name: Build Source Images
on:
push:
branches:
- main
paths:
- "build/latest/Dockerfile*"
- "build/latest/defaults/**"
- "build/latest/docker-entrypoint.sh"
repository_dispatch:
# Triggered by a NR script inspecting changes to the 'master' branch of OpenSimulator.
types: [srcbuild]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- version: master
tag: source
folder: build/latest
file: Dockerfile
platforms: linux/amd64
target: final
steps:
- name: Checkout Codebase
uses: actions/checkout@v6
- name: Login to GitHub CR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_SECRET }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
- name: Build for test
if: ${{ !matrix.skip-test }}
uses: docker/build-push-action@v7
with:
push: false
load: true
context: "{{defaultContext}}:${{ matrix.folder }}"
file: "${{ matrix.file }}"
tags: opensimulator-ci:${{ github.run_id }}
build-args: |
OPENSIM_VERSION=${{ matrix.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Cache CST
if: ${{ !matrix.skip-test }}
id: cache-cst
uses: actions/cache@v4
with:
path: ./container-structure-test
key: container-structure-test-linux-amd64
- name: Download CST
if: ${{ !matrix.skip-test && steps.cache-cst.outputs.cache-hit != 'true' }}
run: |
curl -fsSL -o container-structure-test https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
chmod +x container-structure-test
- name: Run CST
if: ${{ !matrix.skip-test }}
run: |
./container-structure-test test --image opensimulator-ci:${{ github.run_id }} --config unit-test.yaml
- name: Push Container
#if: github.event_name != 'schedule' || matrix.tag == 'source'
uses: docker/build-push-action@v7
with:
push: true
context: "{{defaultContext}}:${{ matrix.folder }}"
tags: >
soupbowl/opensimulator:${{ matrix.tag }},
ghcr.io/${{ github.repository }}:${{ matrix.tag }},
platforms: ${{ matrix.platforms }}
file: "${{ matrix.file }}"
build-args: |
OPENSIM_VERSION=${{ matrix.version }}
cache-from: type=gha
cache-to: type=gha,mode=max