mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
chore: Only push versioned docker image on tag builds.
This commit is contained in:
parent
1e11865c4c
commit
1639703c62
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
|
@ -44,17 +44,3 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Build on FreeBSD
|
- name: Build on FreeBSD
|
||||||
run: .travis/cmake-freebsd-stage2
|
run: .travis/cmake-freebsd-stage2
|
||||||
|
|
||||||
build-bootstrap-docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Docker Build
|
|
||||||
run: .travis/tox-bootstrapd-docker
|
|
||||||
- name: Push images to DockerHub
|
|
||||||
if: ${{ github.event_name == 'push' }}
|
|
||||||
run: |
|
|
||||||
docker push toxchat/bootstrap-node:latest
|
|
||||||
docker push toxchat/bootstrap-node:"$(other/print-version)"
|
|
||||||
|
|
23
.github/workflows/docker.yml
vendored
Normal file
23
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
name: docker
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-bootstrap-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Docker Build
|
||||||
|
run: .travis/tox-bootstrapd-docker local
|
||||||
|
- name: Push latest image to DockerHub
|
||||||
|
if: ${{ github.event_name == 'push' }}
|
||||||
|
run: docker push toxchat/bootstrap-node:latest
|
||||||
|
- name: Push versioned image to DockerHub
|
||||||
|
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
|
||||||
|
run: docker push toxchat/bootstrap-node:"$(other/print-version)"
|
|
@ -2,9 +2,13 @@
|
||||||
|
|
||||||
set -exu
|
set -exu
|
||||||
|
|
||||||
|
LOCAL="${1:-}"
|
||||||
|
|
||||||
readarray -t FILES <<<"$(git ls-files)"
|
readarray -t FILES <<<"$(git ls-files)"
|
||||||
|
|
||||||
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
||||||
|
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
||||||
|
|
||||||
sudo useradd \
|
sudo useradd \
|
||||||
--home-dir /var/lib/tox-bootstrapd \
|
--home-dir /var/lib/tox-bootstrapd \
|
||||||
--create-home \
|
--create-home \
|
||||||
|
@ -30,24 +34,28 @@ if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COUNTER=0
|
if [ "$LOCAL" != "local" ]; then
|
||||||
COUNTER_END=120
|
COUNTER=0
|
||||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
COUNTER_END=120
|
||||||
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||||
break
|
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
COUNTER=$(($COUNTER + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
docker logs tox-bootstrapd
|
||||||
|
|
||||||
|
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
||||||
|
echo "Error: Didn't connect to any nodes"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 1
|
else
|
||||||
COUNTER=$(($COUNTER + 1))
|
docker logs tox-bootstrapd
|
||||||
done
|
|
||||||
|
|
||||||
docker logs tox-bootstrapd
|
|
||||||
|
|
||||||
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
|
||||||
echo "Error: Didn't connect to any nodes"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait a bit befrore testing if the container is still running
|
# Wait a bit before testing if the container is still running
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
docker ps -a
|
docker ps -a
|
||||||
|
@ -67,5 +75,3 @@ if ! other/fun/bootstrap_node_info.py ipv4 localhost 33445; then
|
||||||
echo "Error: Unable to get bootstrap node info"
|
echo "Error: Unable to get bootstrap node info"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user