Skip to content

Docker Image CI

Docker Image CI #15891

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ master ]
schedule:
- cron: "0 * * * *"
jobs:
status-build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == false
steps:
- uses: actions/checkout@v4
- name: Check new version
continue-on-error: true
id: status
run: |
LOCALAPPVER=($(cat sandstorm.version))
REMOTEAPPVER=($(curl -s -X GET 'https://api.steamcmd.net/v1/info/581330' | jq -r -e '.data."581330".depots."581333".manifests.public.gid'))
if [ -z "$REMOTEAPPVER" -a "$REMOTEAPPVER" = " " ]; then
echo "Empty Response"
exit 1
fi
if [ "$REMOTEAPPVER" -eq "$REMOTEAPPVER" ] 2>/dev/null
then
echo "$REMOTEAPPVER is an integer"
else
echo "ERROR: parameter must be an integer"
exit 1
fi
if [[ "$LOCALAPPVER" != "$REMOTEAPPVER" ]]; then
echo "$REMOTEAPPVER" >sandstorm.version
exit 0
else
echo "Version not changed"
exit 1
fi
shell: bash
-
name: Login to DockerHub
if: steps.status.outcome == 'success'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: build
if: steps.status.outcome == 'success'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: andrewmhub/insurgency-sandstorm:latest
-
name: Build and push lite
id: build-lite
if: steps.status.outcome == 'success'
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.lite
push: true
tags: andrewmhub/insurgency-sandstorm:lite
- name: login to git
if: steps.status.outcome == 'success'
run: |
git config --global user.name 'Andrew Marchukov'
git config --global user.email "${EMAIL}"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/AndrewMarchukov/insurgency-sandstorm-server-dockerize.git
- name: check for changes
if: steps.build.outcome == 'success'
run: git status
- name: stage changed files
if: steps.build.outcome == 'success'
run: git add sandstorm.version
- name: commit changed files
if: steps.build.outcome == 'success'
run: git commit -m "Auto updating sandstorm.version"
- name: fetch from master
if: steps.build.outcome == 'success'
run: git fetch origin master
- name: push code to master
if: steps.build.outcome == 'success'
run: git push origin HEAD:master