apisix_push_docker_hub.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Push apisix to Docker image
  2. on:
  3. push:
  4. branches: ['release/apisix-**']
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. strategy:
  9. fail-fast: false
  10. matrix:
  11. platform:
  12. - centos
  13. - debian
  14. env:
  15. APISIX_DOCKER_TAG: 3.0.0-${{ matrix.platform }}
  16. steps:
  17. - name: Check out the repo
  18. uses: actions/checkout@v2
  19. - name: Build and run
  20. run: |
  21. make build-on-${{ matrix.platform }}
  22. docker-compose -f ./compose/docker-compose-release.yaml up -d
  23. sleep 30
  24. docker logs compose_apisix_1
  25. - name: Test route
  26. run: |
  27. grep -C 3 '\[error\]' compose/apisix_log/error.log && exit 1
  28. curl http://127.0.0.1:9180/apisix/admin/routes/1 \
  29. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  30. {
  31. "uri": "/get",
  32. "upstream": {
  33. "type": "roundrobin",
  34. "nodes": {
  35. "httpbin.org:80": 1
  36. }
  37. }
  38. }'
  39. result_code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/get`
  40. if [[ $result_code -ne 200 ]];then
  41. printf "result_code: %s\n" "$result_code"
  42. exit 125
  43. fi
  44. - name: Login to Docker Hub
  45. uses: docker/login-action@v1
  46. with:
  47. username: ${{ secrets.DOCKERHUB_USER }}
  48. password: ${{ secrets.DOCKERHUB_TOKEN }}
  49. - name: Set up QEMU
  50. uses: docker/setup-qemu-action@v1
  51. - name: Set up Docker Buildx
  52. uses: docker/setup-buildx-action@v1
  53. - name: push apisix:latest image to docker hub
  54. if: matrix.platform == 'debian'
  55. run: |
  56. make push-multiarch-on-latest
  57. - name: Push apisix:${{ matrix.os }} image to Docker Hub
  58. run: |
  59. make push-multiarch-on-${{ matrix.platform }}