fix: add #173
Workflow file for this run
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: Validate Docker Image 🐳 | |
on: | |
push: | |
branches-ignore: | |
- main | |
- beta | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and Validate 🏁 | |
runs-on: ubuntu-latest | |
concurrency: ci-${{ github.ref }} | |
env: | |
GAME: cstrike | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx 🛠️ | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker Image 🐳 | |
uses: docker/build-push-action@v6 | |
env: | |
GAME: ${{ env.GAME }} | |
with: | |
context: ./container | |
build-args: | | |
GAME=${{ env.GAME }} | |
load: true | |
- name: Get Docker Image ID 🆔 | |
id: get_image_id | |
run: echo "image_id=$(docker images -q | head -n 1)" >> $GITHUB_ENV | |
- name: Add Custom Mod Content 📂 | |
run: | | |
mkdir -p ./mods/decay | |
touch ./mods/decay/plugin.ini | |
- name: Add Configuration 📂 | |
run: | | |
mkdir -p ./config | |
mkdir -p ./config/maps | |
touch ./config/test.cfg | |
touch ./config/maps/crazytank.bsp | |
- name: Run Docker Container 🐳 | |
run: | | |
docker run -d -ti \ | |
--name hlds \ | |
-v "./config:/temp/config" \ | |
-v "./mods:/temp/mods" \ | |
-p 27015:27015/udp \ | |
-p 27015:27015 \ | |
-p 26900:26900/udp \ | |
-e GAME=${GAME} \ | |
${{ env.image_id }} \ | |
"+log on +rcon_password changeme +maxplayers 12 +map cs_italy" | |
- name: Validate Directory Mappings 📂 | |
run: | | |
# Check if plugin.ini exists in the decay directory | |
if [ "$(docker exec hlds ls /opt/steam/hlds/decay | grep -c 'plugin.ini')" -eq 0 ]; then | |
echo "plugin.ini file is missing in the decay directory!" | |
exit 1 | |
fi | |
# Check if test.cfg exists in the game directory | |
if [ "$(docker exec hlds ls /opt/steam/hlds/${{ env.GAME }} | grep -c 'test.cfg')" -eq 0 ]; then | |
echo "test.cfg file is missing in the ${{ env.GAME }} directory!" | |
exit 1 | |
fi | |
# Check if crazytank.bsp exists in the maps directory | |
if [ "$(docker exec hlds ls /opt/steam/hlds/${{ env.GAME }}/maps | grep -c 'crazytank.bsp')" -eq 0 ]; then | |
echo "crazytank.bsp file is missing in the maps directory!" | |
exit 1 | |
fi | |
echo "Volume mappings work as expectected!" | |
- name: Validate Game Directory Is Present 📂 | |
run: | | |
GAME_NAME=$(echo "${{ env.GAME }}" | sed 's/-legacy//') | |
if [ "$(docker exec hlds ls /opt/steam/hlds | grep -c "$GAME_NAME")" -eq 0 ]; then | |
echo "$GAME_NAME directory is missing!" | |
exit 1 | |
fi | |
- name: Cleanup 🧹 | |
if: always() | |
run: | | |
docker stop hlds | |
docker rm hlds | |
docker system prune --all --force |