.build.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. image: alpine/latest
  2. packages:
  3. - docker
  4. sources:
  5. - https://git.sr.ht/~mser/synupkeep
  6. environment:
  7. project: synupkeep
  8. docker_image: mserajnik/synupkeep
  9. docker_username: mserajnik
  10. secrets:
  11. - 2be455df-9ff9-4803-bf5e-2c65d9d986a5
  12. tasks:
  13. - skip_if_not_release: |
  14. cd $project
  15. git describe --exact-match HEAD || complete-build
  16. - setup: |
  17. curl -s https://api.github.com/repos/tomwright/dasel/releases/latest | \
  18. grep browser_download_url | \
  19. grep linux_amd64 | \
  20. cut -d '"' -f 4 | \
  21. xargs -n1 curl -Lso dasel && \
  22. chmod +x dasel && \
  23. sudo mv dasel /usr/local/bin/dasel
  24. sudo addgroup $(whoami) docker
  25. sudo service docker start
  26. - build: |
  27. cd $project
  28. version=$(/usr/local/bin/dasel -f pyproject.toml -s "tool.poetry.version")
  29. set +e
  30. docker_ps_return=1
  31. until [ ${docker_ps_return} -eq 0 ]; do
  32. docker ps >/dev/null 2>&1
  33. docker_ps_return=$?
  34. sleep 1
  35. done
  36. set -e
  37. docker build . -t $docker_image:latest -t $docker_image:$version
  38. - publish: |
  39. cat ~/.docker-hub-personal-access-token | docker login --username $docker_username --password-stdin
  40. docker push $docker_image --all-tags