|
| 1 | +# yaml-language-server: $schema=https://json-schema.org/draft-07/schema# |
| 2 | +name: Build Judgehost |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: "version" |
| 9 | + required: true |
| 10 | + default: "latest" |
| 11 | + repo: |
| 12 | + description: "repo" |
| 13 | + required: true |
| 14 | + default: "DOMjudge/domjudge" |
| 15 | + commit_id: |
| 16 | + description: "git commit id" |
| 17 | + required: false |
| 18 | + |
| 19 | +jobs: |
| 20 | + build-judgehost: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Set up QEMU |
| 27 | + id: qemu |
| 28 | + uses: docker/setup-qemu-action@v3 |
| 29 | + with: |
| 30 | + image: tonistiigi/binfmt:latest |
| 31 | + platforms: all |
| 32 | + |
| 33 | + - name: Available platforms |
| 34 | + run: echo ${{ steps.qemu.outputs.platforms }} |
| 35 | + |
| 36 | + - name: Set up Docker Buildx |
| 37 | + id: buildx |
| 38 | + uses: docker/setup-buildx-action@v3 |
| 39 | + |
| 40 | + - name: Inspect builder |
| 41 | + run: | |
| 42 | + echo "Name: ${{ steps.buildx.outputs.name }}" |
| 43 | + echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" |
| 44 | + echo "Status: ${{ steps.buildx.outputs.status }}" |
| 45 | + echo "Flags: ${{ steps.buildx.outputs.flags }}" |
| 46 | + echo "Platforms: ${{ steps.buildx.outputs.platforms }}" |
| 47 | +
|
| 48 | + - name: Login to Docker Hub |
| 49 | + uses: docker/login-action@v3 |
| 50 | + with: |
| 51 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 52 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 53 | + |
| 54 | + - name: Login to ALiYun Shanghai Container Registry |
| 55 | + uses: docker/login-action@v3 |
| 56 | + with: |
| 57 | + registry: registry.cn-shanghai.aliyuncs.com |
| 58 | + username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }} |
| 59 | + password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }} |
| 60 | + |
| 61 | + - name: Download DOMjudge |
| 62 | + run: | |
| 63 | + bash ./docker/download.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.commit_id }} |
| 64 | +
|
| 65 | + - name: Build |
| 66 | + env: |
| 67 | + tag: ${{ github.event.inputs.version }} |
| 68 | + run: | |
| 69 | + cd ./docker |
| 70 | + sudo bash -e build-judgehost.sh dup4/domjudge-judgehost:${{ env.tag }} |
| 71 | +
|
| 72 | + - name: Push |
| 73 | + env: |
| 74 | + registry_namespace: dup4 |
| 75 | + image_name: domjudge-judgehost |
| 76 | + tag: ${{ github.event.inputs.version }} |
| 77 | + run: | |
| 78 | + docker push ${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }} |
| 79 | + docker tag ${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }} registry.cn-shanghai.aliyuncs.com/${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }} |
| 80 | + docker push registry.cn-shanghai.aliyuncs.com/${{ env.registry_namespace }}/${{ env.image_name }}:${{ env.tag }} |
0 commit comments