-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 1.73 KB
/
build.yaml
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
53
54
55
56
57
58
59
60
61
62
63
name: Market Maker Keeper - Build and Push
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
branch:
description: 'Branch to build and deploy'
required: false
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
username: aminntalebi
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Docker Registry - Hamdocker
uses: docker/login-action@v3
with:
registry: registry.hamdocker.ir/bitex
username: ${{ secrets.HAMRAVESH_REGISTRY_USER }}
password: ${{ secrets.HAMRAVESH_REGISTRY_PASS }}
- name: Get the branch name
id: get-branch-name
run: |
if [[ $GITHUB_HEAD_REF ]]; then
BRANCH_NAME=${GITHUB_HEAD_REF}
else
BRANCH_NAME=${GITHUB_REF#refs/heads/}
fi
BRANCH_NAME=$(echo ${BRANCH_NAME} | sed 's/\//-/g' | cut -c 1-30)
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
- name: Set Docker image tag
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=$(echo ${GITHUB_SHA::8})
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build and push api to hamdocker
uses: docker/build-push-action@v4
with:
file: Dockerfile
context: .
push: true
tags: registry.hamdocker.ir/bitex/mmk:${{ env.TAG }}
build-args: |
GITHUB_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}