From d7220b51ff492f96f59c1071509e1c86d4f142cb Mon Sep 17 00:00:00 2001 From: Yoan Tournade Date: Sat, 30 Jul 2022 16:38:29 +0200 Subject: [PATCH] Add Docker Hub pub on release --- .github/workflows/build-and-test.yml | 21 +++------------ .github/workflows/docker-hub-publish.yml | 33 ++++++++++++++++++++++++ container/install_tests.sh | 2 -- 3 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/docker-hub-publish.yml delete mode 100755 container/install_tests.sh diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ee2c0fe..56af693 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,6 +8,8 @@ on: pull_request: paths-ignore: - '**.md' + branches: + - master jobs: build-ant-test: @@ -22,9 +24,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - # - name: Install tests - # run: ./container/install_tests.sh - # shell: bash - name: Install dependencies run: | python -m pip install --upgrade pip @@ -34,18 +33,4 @@ jobs: run: make docker-build-all - name: Run tests (using locally built Docker images) run: make test-docker-compose - -# TODO Publish images to Docker hub. -# Only on tag or release -# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release - -# From Travis.yml: -# # Publish images to Docker hub. -# # Only in master branch commits. -# # https://docs.travis-ci.com/user/docker/#pushing-a-docker-image-to-a-registry -# # Could also be done in an after_success, see https://ops.tips/blog/travis-ci-push-docker-image/ -# deploy: -# provider: script -# script: bash container/docker_push.sh -# on: -# branch: master + \ No newline at end of file diff --git a/.github/workflows/docker-hub-publish.yml b/.github/workflows/docker-hub-publish.yml new file mode 100644 index 0000000..4d77aef --- /dev/null +++ b/.github/workflows/docker-hub-publish.yml @@ -0,0 +1,33 @@ +name: docker-hub-publish +on: + release: + types: [published] + +jobs: + build-ant-test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + make install-dev + - name: Build Docker images + run: make docker-build-all + - name: Run tests (using locally built Docker images) + run: make test-docker-compose + - name: Docker Hub push + run: ./container/docker_push.sh + shell: bash + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/container/install_tests.sh b/container/install_tests.sh deleted file mode 100755 index 8f048a3..0000000 --- a/container/install_tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -apt-get update && apt-get install -y \ - poppler-utils