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
|
||||
- name: Build on FreeBSD
|
||||
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
|
||||
|
||||
LOCAL="${1:-}"
|
||||
|
||||
readarray -t FILES <<<"$(git ls-files)"
|
||||
|
||||
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 \
|
||||
--home-dir /var/lib/tox-bootstrapd \
|
||||
--create-home \
|
||||
|
@ -30,24 +34,28 @@ if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
COUNTER=0
|
||||
COUNTER_END=120
|
||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
||||
break
|
||||
if [ "$LOCAL" != "local" ]; then
|
||||
COUNTER=0
|
||||
COUNTER_END=120
|
||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||
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
|
||||
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
|
||||
else
|
||||
docker logs tox-bootstrapd
|
||||
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
|
||||
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
||||
|
|
Loading…
Reference in New Issue
Block a user