-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (58 loc) · 2.42 KB
/
main.yml
File metadata and controls
64 lines (58 loc) · 2.42 KB
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
64
name: demyx/docker-socket-proxy
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * 6'
jobs:
master:
runs-on: ubuntu-latest
env:
DEMYX_REPOSITORY: docker-socket-proxy
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login
uses: docker/login-action@v1
with:
username: demyx
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: |
docker pull tecnativa/docker-socket-proxy
docker build -t demyx/${{ env.DEMYX_REPOSITORY }} .
- name: Test
id: test
shell: 'script -q -e -c "bash {0}"'
run: |
docker run -d --name=${{ env.DEMYX_REPOSITORY }} demyx/${{ env.DEMYX_REPOSITORY }}
DEMYX_TEST="$(docker exec ${{ env.DEMYX_REPOSITORY }} cat /usr/local/etc/haproxy/haproxy.cfg)"
if [[ "$DEMYX_TEST" == *"bind :2375"* ]]; then
echo "$DEMYX_TEST"
else
exit 1
fi
- name: Version
run: |
DEMYX_DOCKER_SOCKET_PROXY_ALPINE_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} cat /etc/os-release | grep VERSION_ID | cut -c 12-)"
DEMYX_DOCKER_SOCKET_PROXY_HAPROXY_VERSION="$(docker exec ${{ env.DEMYX_REPOSITORY }} haproxy -v | grep HA-Proxy | awk '{print $3}')"
DEMYX_JQ="$(jq ".alpine = \"$DEMYX_DOCKER_SOCKET_PROXY_ALPINE_VERSION\" | .docker_socket_proxy = \"$DEMYX_DOCKER_SOCKET_PROXY_HAPROXY_VERSION\"" version.json)"
# Update versions
echo "$DEMYX_JQ" > version.json
echo "DEMYX_DOCKER_SOCKET_PROXY_ALPINE_VERSION=$DEMYX_DOCKER_SOCKET_PROXY_ALPINE_VERSION
DEMYX_DOCKER_SOCKET_PROXY_HAPROXY_VERSION=$DEMYX_DOCKER_SOCKET_PROXY_HAPROXY_VERSION" > VERSION
- name: Push
run: |
# Not sure why this is being created?
[[ -f typescript ]] && rm -f typescript
DEMYX_CHECK_STATUS="$(git status)"
if [[ "$DEMYX_CHECK_STATUS" != *"nothing to commit"* ]]; then
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
git remote set-url origin https://demyxsh:${{ secrets.DEMYX_TOKEN }}@github.com/demyxsh/${{ env.DEMYX_REPOSITORY }}
git add .
git commit -m "Schedule Build #${{ github.run_id }}"
git push
fi
docker push demyx/${{ env.DEMYX_REPOSITORY }}