Update validate.yml #133
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: | |
runs-on: ubuntu-latest | |
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: cstrike | |
with: | |
context: ./container | |
build-args: GAME=cstrike | |
load: true | |
- name: Get Docker Image ID 🆔 | |
id: get_image_id | |
run: echo "::set-output name=image_id::$(docker images -q | head -n 1)" | |
- name: Add Custom Mod Content 📂 | |
run: | | |
mkdir -p ./mods | |
mkdir -p ./mods/decay | |
touch ./mods/decay/plugin.ini | |
- name: Add Configuration 📂 | |
run: | | |
mkdir -p ./config | |
touch ./config/test.cfg | |
- name: Run Docker Container 🐳 | |
run: | | |
docker run -d --name test-container ${{ steps.get_image_id.outputs.image_id }} | |
- name: Inspect Container Directories 🕵️♂️ | |
run: | | |
echo "Listing contents of /opt/steam:" | |
docker exec test-container ls /opt/steam | |
echo "Listing contents of /opt/steam/hlds:" | |
docker exec test-container ls /opt/steam/hlds | |
echo "Listing contents of /opt/steam/hlds/decay:" | |
docker exec test-container ls /opt/steam/hlds/decay | |
echo "Listing contents of /opt/steam/hlds/cstrike:" | |
docker exec test-container ls /opt/steam/hlds/cstrike | |
- name: Validate Directory Mappings 📂 | |
run: | | |
# Check if plugin.ini exists in the decay directory | |
if [ "$(docker exec test-container 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 cstrike directory | |
if [ "$(docker exec test-container ls /opt/steam/hlds/cstrike | grep -c 'test.cfg')" -eq 0 ]; then | |
echo "test.cfg file is missing in the cstrike directory!" | |
exit 1 | |
fi | |
echo "Volume mappings work as expectected!" | |
- name: Cleanup 🧹 | |
if: always() | |
run: | | |
docker stop test-container | |
docker rm test-container |