forked from r-pufky/steam
-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (72 loc) · 2.89 KB
/
ci.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
85
name: Build Steam Docker Image and Deploy
on:
# Run on every main branch push
push:
branches: [ "main" ]
# Run every day at midnight
schedule:
- cron: "0 0 * * *"
jobs:
# Deploy a new image to DockerHub
build-and-publish-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Build all supported container images
- name: Build Containers
run: make all
# Authenticate with DockerHub prior to publishing
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Publish our built container images
- name: Push docker images to DockerHub
run: |
# Push the default tags to DockerHub
docker push thetestgame/steam:stable
docker push thetestgame/steam:latest
docker push thetestgame/steam:winehq
docker push thetestgame/steam:experimental
# Only add SHA tags if the event is a push to the main branch
if [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/heads/main' ]]; then
# Retrieve the short SHA
SHORT_SHA=$(git rev-parse --short HEAD)
# Tag and push the images with the new tags
docker tag thetestgame/steam:stable thetestgame/steam:stable-$SHORT_SHA
docker tag thetestgame/steam:latest thetestgame/steam:latest-$SHORT_SHA
docker tag thetestgame/steam:winehq thetestgame/steam:winehq-$SHORT_SHA
docker tag thetestgame/steam:experimental thetestgame/steam:experimental-$SHORT_SHA
docker push thetestgame/steam:stable-$SHORT_SHA
docker push thetestgame/steam:latest-$SHORT_SHA
docker push thetestgame/steam:winehq-$SHORT_SHA
docker push thetestgame/steam:experimental-$SHORT_SHA
fi
# Keep the workflow alive
- uses: gautamkrishnar/keepalive-workflow@v1 # using the workflow with default settings
# Create/Update our local last-built.txt file and commit it back
# to the repository for remote monitoring.
- name: Update last-built.txt
run: |
echo "Last built: $(date)" > last-built.txt
- uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'ci: Update last-built.txt'
branch: main
commit_user_name: Github-Actions 🤖
commit_user_email: actions@github.com
commit_author: Github-Actions🤖 <actions@github.com>
# Update our DockerHub README
docker-hub-description:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: thetestgame/steam