-
Notifications
You must be signed in to change notification settings - Fork 10
84 lines (84 loc) · 2.82 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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@v3
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@v6
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@v6
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