-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (49 loc) · 1.44 KB
/
docker.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
53
54
55
name: Build and push docker images
on:
workflow_dispatch:
inputs:
tags:
description: "Comment"
push:
branches: [main]
paths:
- "app.yao"
- ".github/workflows/docker.yml"
env:
IMAGE_ORG: yaoapp
IMAGE_NAME: "demo-neo"
REPO_DOCKERFILES: ${{ github.repository_owner }}/dockerfiles
VERSION: 1.0.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Application Source
uses: actions/checkout@v2
- name: Get Version
run: |
VERSION=$(cat ./neo/app.yao |grep version |awk -F : '{print $2}' | sed 's/"//g' | sed 's/,//g' | sed 's/ //g')
if [ -z "$VERSION" ]; then
VERSION=1.0.0
fi
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Check Version
run: echo $VERSION
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build & Push Docker Image AMD64
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/amd64
build-args: |
VERSION=${{ env.VERSION }}
push: true
tags: ${{ env.IMAGE_ORG }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-amd64