sandstorm-server/.github/workflows/docker-image.yml
AndrewMarchukov 3369f68d44 fixes
2022-07-14 15:32:14 +04:00

68 lines
No EOL
2.3 KiB
YAML

name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 * * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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'))
if [ -z "$REMOTEAPPVER" -a "$REMOTEAPPVER" = " " ]; then
echo "Empty Response"
exit 1
fi
if [[ "$LOCALAPPVER" != "$REMOTEAPPVER" ]]; then
echo "$REMOTEAPPVER" >sandstorm.version
exit 0
else
echo "Download Failed"
exit 1
fi
shell: bash
-
name: Login to DockerHub
if: steps.status.outcome == 'success'
uses: docker/login-action@v1
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@v2
with:
context: .
push: true
tags: andrewmhub/insurgency-sandstorm:latest
- 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.GIT_TOKEN }}@github.com/AndrewMarchukov/insurgency-sandstorm-server-dockerize.git
- name: check for changes
if: steps.status.outcome == 'success'
run: git status
- name: stage changed files
if: steps.status.outcome == 'success'
run: git add sandstorm.version
- name: commit changed files
if: steps.status.outcome == 'success'
run: git commit -m "Auto updating sandstorm.version"
- name: fetch from master
if: steps.status.outcome == 'success'
run: git fetch origin master
- name: push code to master
if: steps.status.outcome == 'success'
run: git push origin HEAD:master