forked from QingdaoU/JudgeServer
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.44 KB
/
test.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
name: Test
on:
push:
branches: [ master, develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
# 8位commit id
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Docker Login
uses: docker/login-action@v2
with:
registry: registry.cn-shenzhen.aliyuncs.com
username: ${{ secrets.DOCKER_REG_USERNAME }}
password: ${{ secrets.DOCKER_REG_PASSWORD }}
- name: Build and Push Docker images
id: docker_build
uses: docker/build-push-action@v3
env:
OJ_JUDGER_VERSION: ${{ github.ref_name }}-${{ steps.short-sha.outputs.sha }}
with:
context: ./
push: true
build-args: |
OJ_JUDGER_VERSION=${{ env.OJ_BE_VERSION }}
tags: |
registry.cn-shenzhen.aliyuncs.com/szuoj/judge_server:${{ github.ref_name }}
registry.cn-shenzhen.aliyuncs.com/szuoj/judge_server:${{ env.OJ_JUDGER_VERSION }}
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}