Skip to content

Docker Image CI

Docker Image CI #29

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '.vscode/**'
- '.github/workflows/dockerhub-description.yml'
pull_request:
workflow_dispatch:
schedule:
- cron: '0 1 * * 0'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
mod: [
{ slug: valve, tagName: legacy },
{ slug: valve, tagName: bugfixedhl },
{ slug: cstrike, tagName: legacy },
{ slug: cstrike, tagName: regamedll },
{ slug: czero, tagName: legacy },
{ slug: czero, tagName: regamedll },
{ slug: dod, tagName: legacy },
{ slug: gearbox, tagName: legacy },
{ slug: tfc, tagName: legacy },
{ slug: ricochet, tagName: legacy },
{ slug: dmc, tagName: legacy },
]
env:
isMasterBranch: ${{ github.ref_name == github.event.repository.default_branch }}
steps:
- uses: actions/[email protected]
- uses: docker/[email protected]
- name: Log in to Docker Hub
if: ${{ env.isMasterBranch }}
uses: docker/[email protected]
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/[email protected]
env:
rehldsVersion: latest
modName: ${{ matrix.mod.slug }}
tag: ${{ matrix.mod.tagName }}
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ env.isMasterBranch }}
tags: |
${{ vars.DOCKER_USERNAME }}/rehlds-${{ env.modName }}:${{ env.tag }}
${{ env.tag == 'legacy' && format('{0}/rehlds-{1}:latest', vars.DOCKER_USERNAME, env.modName) || null}}
build-args: |
MOD=${{ env.modName }}
ReHLDS_VERSION=${{ env.rehldsVersion }}
${{ env.tag != 'legacy' && 'ReGameDLL_VERSION=latest' || '' }}
${{ env.tag == 'legacy' && 'BugfixedHL_LINK=' || ''}}
cache-from: type=gha,scope=build-${{ env.modName }}-${{ env.tag }}
cache-to: type=gha,mode=max,scope=build-${{ env.modName }}-${{ env.tag }}