Skip to content

Commit

Permalink
Auto updating
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonsturgeon committed Jul 24, 2024
1 parent 015e41d commit b7d2e33
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 80 deletions.
83 changes: 83 additions & 0 deletions .github/actions/build_and_push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build and Push
description: Builds and pushes the latest steamcmd image to GitHub Container Registry

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
github_token:
description: "GitHub token for pushing to GitHub Container Registry"
required: true

runs:
using: "composite"
steps:
- name: Build
shell: bash
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
shell: bash
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
shell: bash
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_update +app_info_print 4020 +logoff +quit'
- name: Add latest tag
shell: bash
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: ${{ inputs.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
80 changes: 0 additions & 80 deletions .github/workflows/build_and_push.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
workflow_dispatch:
schedule:
- cron: '18 4 */5 * *'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Latest Tag
id: latest_tag
run: |
latest_tag=$(git describe --tags --abbrev=0 --match='[0-9]*.[0-9]*.[0-9]*' --match='[0-9]*.[0-9]*' --exclude='*[^0-9.]*')
echo "Latest tag: $latest_tag"
echo "tag_name=$latest_tag" >> $GITHUB_OUTPUT
- name: Push new build
uses: ./.github/actions/build_and_push
with:
tag: ${{ steps.latest_tag.outputs.tag_name }}
release: true
github_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit b7d2e33

Please sign in to comment.