Skip to content

Update Servers

Update Servers #2

name: Update Servers
on:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
update:
runs-on: ubuntu-latest
outputs:
has_updates: ${{ steps.update.outputs.has_updates }}
updated_servers: ${{ steps.update.outputs.updated_servers }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.12'
- name: Run update script
id: update
run: uv run scripts/update_containers.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit and push changes
if: steps.update.outputs.has_updates == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add container/
git commit -m "chore: update server versions"
git push
build:
needs: update
if: needs.update.outputs.has_updates == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
server: ${{ fromJson(needs.update.outputs.updated_servers) }}
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: get_version
run: |
VERSION=$(grep "ARG VERSION=" container/${{ matrix.server }}/ContainerFile | cut -d'=' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
with:
context: container/${{ matrix.server }}
file: container/${{ matrix.server }}/ContainerFile
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.server }}:${{ steps.get_version.outputs.version }}
ghcr.io/${{ github.repository }}/${{ matrix.server }}:latest