2020-11-02 10:42:09 +08:00
|
|
|
name: Publish Builder
|
|
|
|
# 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:
|
2021-04-27 19:27:50 +08:00
|
|
|
- 'build/docker/builder/**'
|
2020-11-02 10:42:09 +08:00
|
|
|
- '.github/workflows/publish-builder.yaml'
|
2021-07-09 14:08:00 +08:00
|
|
|
- '!**.md'
|
2020-11-02 10:42:09 +08:00
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
2021-04-27 19:27:50 +08:00
|
|
|
- 'build/docker/builder/**'
|
2020-11-02 10:42:09 +08:00
|
|
|
- '.github/workflows/publish-builder.yaml'
|
2021-07-09 14:08:00 +08:00
|
|
|
- '!**.md'
|
2020-11-02 10:42:09 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-builder:
|
2021-07-08 15:43:45 +08:00
|
|
|
name: AMD64 ${{ matrix.os }}
|
2020-11-02 10:42:09 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-07-08 16:35:28 +08:00
|
|
|
os: [ubuntu18.04, centos7]
|
2020-11-02 10:42:09 +08:00
|
|
|
env:
|
2021-07-08 15:43:45 +08:00
|
|
|
OS_NAME: ${{ matrix.os }}
|
2020-11-02 10:42:09 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-11-02 18:49:11 +08:00
|
|
|
- name: Get version from system time after release step
|
|
|
|
id: extracter
|
2021-07-09 11:59:09 +08:00
|
|
|
run: echo "::set-output name=version::$(date +%Y%m%d)"
|
2020-11-17 15:06:48 +08:00
|
|
|
- name: Docker Pull
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-08-01 16:14:25 +08:00
|
|
|
docker-compose pull --ignore-pull-failures builder
|
2020-11-02 10:42:09 +08:00
|
|
|
- name: Docker Build
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-07-08 16:35:28 +08:00
|
|
|
DATE_VERSION=${{ steps.extracter.outputs.version }} docker-compose build builder
|
2021-08-01 16:14:25 +08:00
|
|
|
export LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}
|
|
|
|
DATE_VERSION=latest docker-compose build builder
|
2020-11-02 10:42:09 +08:00
|
|
|
- name: Docker Push
|
2021-04-26 13:59:28 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
2020-11-02 10:42:09 +08:00
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
docker login -u ${{ secrets.DOCKERHUB_USER }} \
|
|
|
|
-p ${{ secrets.DOCKERHUB_TOKEN }}
|
2021-07-08 16:35:28 +08:00
|
|
|
DATE_VERSION=${{ steps.extracter.outputs.version }} docker-compose push builder
|
2021-08-01 16:14:25 +08:00
|
|
|
DATE_VERSION=latest docker-compose push builder
|
2021-07-12 17:06:18 +08:00
|
|
|
- name: Update Builder Image Changes
|
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
|
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-07-13 16:06:26 +08:00
|
|
|
sed -i "s#^DATE_VERSION=.*#DATE_VERSION=${{ steps.extracter.outputs.version }}#g" .env
|
2021-08-01 16:14:25 +08:00
|
|
|
sed -i "s#^LATEST_DATE_VERSION=.*#LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}#g" .env
|
2021-07-12 17:06:18 +08:00
|
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
git add .env
|
2021-07-13 16:06:26 +08:00
|
|
|
git commit -m "Update Builder image changes"
|
2021-07-13 15:12:27 +08:00
|
|
|
- name: Create Pull Request
|
|
|
|
id: cpr
|
2021-07-12 17:28:14 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu18.04'
|
2021-07-12 17:06:18 +08:00
|
|
|
continue-on-error: true
|
2021-07-13 15:22:43 +08:00
|
|
|
uses: peter-evans/create-pull-request@v3
|
2021-07-13 15:12:27 +08:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
|
|
|
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
|
|
signoff: false
|
2021-07-13 15:44:48 +08:00
|
|
|
branch: update_builder_${{ github.sha }}
|
2021-07-13 15:12:27 +08:00
|
|
|
delete-branch: true
|
2021-07-13 16:06:26 +08:00
|
|
|
title: '[automated] Update Builder image changes'
|
2021-07-13 15:12:27 +08:00
|
|
|
body: |
|
2021-07-13 16:06:26 +08:00
|
|
|
Update Builder image changes
|
2021-07-13 15:12:27 +08:00
|
|
|
|
|
|
|
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
|
|
|
|
- name: Check outputs
|
2021-07-13 15:22:43 +08:00
|
|
|
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu18.04'
|
2021-07-12 18:11:32 +08:00
|
|
|
run: |
|
2021-07-13 15:12:27 +08:00
|
|
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
|
|
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|