Skip to content

Keep trackable record of last built. #81

Keep trackable record of last built.

Keep trackable record of last built. #81

Workflow file for this run

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