-
Notifications
You must be signed in to change notification settings - Fork 20
52 lines (43 loc) · 1.75 KB
/
docker_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
51
52
name: Docker Image CI
on:
push:
branches: ['prep/**', 'release/**', 'test/**', master]
tags: ['**']
jobs:
# build_docker_image:
# uses: filecoin-project/venus/.github/workflows/common_docker_image.yml@master
# secrets:
# DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
# todo: replace this job with action from venus
build_docker_image:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Create vars
id: vars
run: |
export github_tag=${{ github.ref_name }}
export repo_name=${GITHUB_REPOSITORY##*/}
export is_tag_create=false
export docker_user_name='filvenus'
export rx_tag='^refs\/tags\/.*'
export rx_version_tag='^v([0-9]+\.){0,2}(\*|[0-9]+)(-rc[0-9]*){0,1}$'
if [[ "${{github.ref}}" =~ $rx_tag ]]; then
export is_tag_create=true
fi
echo "::set-output name=github_tag::$github_tag"
echo "::set-output name=repo_name::$repo_name"
echo "::set-output name=is_tag_create::$is_tag_create"
echo "::set-output name=docker_user_name::$docker_user_name"
- name: Show environment
run: |
echo is_tag_create = ${{ steps.vars.outputs.is_tag_create }}
echo github_tag = ${{ steps.vars.outputs.github_tag }}
echo repo_name = ${{ steps.vars.outputs.repo_name }}
echo docker_user_name = ${{steps.vars.outputs.docker_user_name}}
echo docker_password = ${{secrets.DOCKER_PASSWORD}}
- name: Build the Docker image
if: ${{ steps.vars.outputs.is_tag_create == 'true' }}
run: |
docker login --username=${{steps.vars.outputs.docker_user_name}} --password ${{ secrets.DOCKER_PASSWORD }}
make docker-push TAG=${{ steps.vars.outputs.github_tag }}