-
Notifications
You must be signed in to change notification settings - Fork 254
51 lines (48 loc) · 1.87 KB
/
publish_ut_image.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
name: Publish UT Image
# This workflow is triggered on pushes or pull request to the repository.
on:
push:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'Dockerfile'
- 'GPUDockerfile'
- 'requirement.txt'
- '.github/workflows/publish_ut_image.yml'
pull_request:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'Dockerfile'
- 'GPUDockerfile'
- 'requirement.txt'
- '.github/workflows/publish_ut_image.yml'
jobs:
publish-ut-images:
name: UT
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get version from system time after release step
id: extracter
run: |
echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker Build
shell: bash
run: |
export IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
DOCKER_BUILDKIT=1 docker build -t towhee/towhee-ut:${IMAGE_TAG} -t towhee/towhee-ut:latest -f Dockerfile .
DOCKER_BUILDKIT=1 docker build -t towhee/towhee-ut:gpu-latest -f GPUDockerfile .
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'towhee-io/towhee'
continue-on-error: true
shell: bash
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
export IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
docker push towhee/towhee-ut:${IMAGE_TAG}
docker push towhee/towhee-ut:latest
docker push towhee/towhee-ut:gpu-latest
echo "Push towhee-ut image Succeeded"