-
Notifications
You must be signed in to change notification settings - Fork 339
52 lines (48 loc) · 1.55 KB
/
build_proxy.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: NginxProxyManage Build And Push To DockerHub
on:
push:
branches: [main]
paths:
- "docker/proxy/Dockerfile"
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
env:
TAGS: latest
steps:
- uses: actions/checkout@v2
name: Check out code
- name: Get version
run: |
version=$(grep -Po '(?<=LABEL version=").*?(?=")' docker/proxy/Dockerfile)
echo $version
real_version=${version%%-*}
echo "VERSION=$version" >> $GITHUB_ENV
if [ "$version" != "$real_version" ]; then
version_list=$version
else
IFS='.' read -ra VERSION_PARTS <<< "$real_version"
version_list="latest"
version_accumulator=""
for i in "${VERSION_PARTS[@]}"; do
if [ -z "$version_accumulator" ]; then
version_accumulator=$i
else
version_accumulator=$version_accumulator.$i
fi
version_list=$version_accumulator,$version_list
done
fi
echo "VERSION_LIST=$version_list" >> $GITHUB_ENV
- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Docker image
with:
image: websoft9dev/proxy
tags: ${{ env.VERSION_LIST }}
addLatest: True
registry: docker.io
dockerfile: docker/proxy/Dockerfile
directory: docker/proxy
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}