Build and Push #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: "Tag name for the Docker image (or version tag)" | |
required: true | |
release: | |
type: boolean | |
description: "Is this a full release?" | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
cd $GITHUB_WORKSPACE/bullseye | |
docker build \ | |
--target=bullseye \ | |
--tag ghcr.io/cfc-servers/steamcmd:${{ inputs.tag_name }} \ | |
--tag ghcr.io/cfc-servers/steamcmd:steam \ | |
. | |
- name: Get docker-slim | |
run: | | |
SLIM_VERSION=1.40.11 | |
curl --location --output ds.tar.gz https://github.com/slimtoolkit/slim/releases/download/$SLIM_VERSION/dist_linux.tar.gz | |
tar -xvzf ds.tar.gz | |
mv dist_linux/* $GITHUB_WORKSPACE | |
rm -rfv ds.tar.gz dist_linux/ | |
- name: Make slim image | |
run: | | |
version=${{ inputs.tag_name }} | |
$GITHUB_WORKSPACE/docker-slim build \ | |
--target ghcr.io/cfc-servers/steamcmd:$version \ | |
--http-probe-off \ | |
--show-clogs --show-blogs \ | |
--tag ghcr.io/cfc-servers/steamcmd-slim:$version \ | |
--tag ghcr.io/cfc-servers/steamcmd-slim:steam \ | |
--exec '/home/steam/steamcmd/steamcmd.sh +login anonymous +app_info_print 4020 +quit' | |
- name: Add latest tag | |
run: | | |
BASE=ghcr.io/cfc-servers/steamcmd | |
version=${{ inputs.tag_name }} | |
# Tag image with "0.27" if we push tag "0.27.5" | |
# but not if we push tag "0.27-pre5" | |
minorVersion=${version%.*} | |
if [[ $minorVersion != "0" ]]; then | |
echo "::warning:: Tagging with parent minor version: $minorVersion" | |
docker tag $BASE:$version $BASE:$minorVersion | |
docker tag $BASE-slim:$version $BASE-slim:$minorVersion | |
fi | |
if [ "${{ inputs.release }}" = "true" ]; then | |
echo "::warning:: Tagging this release as the latest!" | |
docker tag $BASE:$version $BASE:latest | |
docker tag $BASE-slim:$version $BASE-slim:latest | |
fi | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tag and push slim images | |
run: | | |
docker push ghcr.io/cfc-servers/steamcmd --all-tags | |
docker push ghcr.io/cfc-servers/steamcmd-slim --all-tags |