milvus/.github/workflows/publish-test-images.yaml
quicksilver d6f8846e88
Fix Protected branch update failed (#6452)
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
2021-07-12 18:24:07 +08:00

69 lines
2.9 KiB
YAML

name: Publish Test Images
# TODO: do not trigger action for some document file update
# This workflow is triggered on pushes or pull request to the repository.
on:
push:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'tests/docker/Dockerfile'
- 'tests/python_test/requirements.txt'
- '.github/workflows/publish-test-images.yaml'
- '!**.md'
pull_request:
# file paths to consider in the event. Optional; defaults to all.
paths:
- 'tests/docker/Dockerfile'
- 'tests/python_test/requirements.txt'
- '.github/workflows/publish-test-images.yaml'
- '!**.md'
jobs:
publish-pytest-images:
name: PyTest
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get version from system time after release step
id: extracter
run: |
echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker Build
shell: bash
working-directory: tests/docker
run: |
docker-compose pull --ignore-pull-failures pytest
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose build pytest
IMAGE_TAG=latest docker-compose build pytest
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
shell: bash
working-directory: tests/docker
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose push pytest
IMAGE_TAG=latest docker-compose push pytest
echo "Push pytest image Succeeded"
- name: Update Pytest Image Changes
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
shell: bash
working-directory: tests/docker
run: |
sed -i "s#IMAGE_TAG=.*#IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env
git commit -m "Update Pytest Image Changes"
- name: Push Pytest Image Changes
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
shell: bash
run: |
git push "https://sre-ci-robot:${{ secrets.ALL_CONTRIBUTORS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ github.ref }} --follow-tags