Skip to content

Install tools for dumping the database #48

Install tools for dumping the database

Install tools for dumping the database #48

name: 'Build domjudge container (Release)'
on:
push:
branches:
- main
workflow_dispatch:
inputs:
DOMJUDGE_VERSION:
description: 'Version of DOMjudge to build'
required: true
default: 'M.m.p'
DOMJUDGE_LATEST:
description: 'Overwrite the latest tag'
required: true
default: 'true'
env:
DOMJUDGE_VERSION: M.m.p
DOMJUDGE_LATEST: true
jobs:
release-domjudge:
if: ${{ github.repository == 'domjudge/domjudge-packaging' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: If manually dispatched use input variables
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "DOMJUDGE_VERSION=${{ inputs.DOMJUDGE_VERSION }}" >> $GITHUB_ENV
echo "DOMJUDGE_LATEST=${{ inputs.DOMJUDGE_LATEST }}" >> $GITHUB_ENV
- name: If needed overwrite the DOMJUDGE_VERSION for this run
run: |
if [ ${{ env.DOMJUDGE_VERSION }} != "M.m.p" ]; then
exit 0
fi
if [ ${{ env.DOMJUDGE_LATEST }} == "false" ]; then
echo "I don't know which version to pick!"
exit 1
fi
sudo apt-get update; sudo apt-get install jq curl -y
set -x
HUBURL="https://registry.hub.docker.com/v2/repositories/domjudge/domserver/tags"
TAG=$(curl $HUBURL|jq '.results | sort_by(.name) | .[-2].name')
DJ_TAG=${TAG//\"}
set +x
echo "DOMJUDGE_VERSION=$DJ_TAG" >> $GITHUB_ENV
- name: Build the container
run: |
cd docker
./build.sh "${{ env.DOMJUDGE_VERSION }}"
- name: Build and push
run: |
for IMG in domserver judgehost default-judgehost-chroot; do
docker push domjudge/$IMG:${{ env.DOMJUDGE_VERSION }}
if [ ${{ env.DOMJUDGE_LATEST }} = "true" ]; then
docker tag domjudge/$IMG:${{ env.DOMJUDGE_VERSION }} domjudge/$IMG:latest
docker push domjudge/$IMG
fi
done