From 1e7fdb4ccaf3ccb69a1106145b09999809bfed21 Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Sat, 30 Dec 2023 11:13:48 +0800 Subject: [PATCH] ci: add two ci jobs (#48) * ci: py project job * ci: backport job --- .github/workflows/backport.yml | 20 +++++++++++++++ .github/workflows/py.yml | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/backport.yml create mode 100644 .github/workflows/py.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 0000000..00ca3fb --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,20 @@ +name: backport + +# backport by issue a label (backport ) on merged PR + +on: + pull_request_target: + types: [closed, labeled] +jobs: + backport: + permissions: + contents: write # so it can comment + pull-requests: write # so it can create pull requests + name: Backport Pull Request + if: github.event.pull_request.merged + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create backport PRs + uses: korthout/backport-action@v2 diff --git a/.github/workflows/py.yml b/.github/workflows/py.yml new file mode 100644 index 0000000..f48b62d --- /dev/null +++ b/.github/workflows/py.yml @@ -0,0 +1,46 @@ +name: Python package + +# necessary check for Python project, publish to PyPI performed locally + +on: + push: + branches: + - main + tags: + - v* + pull_request: + workflow_dispatch: + +jobs: + py-package: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - run: | + pip install --no-cache-dir poetry + + - name: verify + if: startsWith(github.ref, 'refs/tags/v') + run: | + py_version=$(poetry version --short) + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + tag_version=${VERSION#v} + if [[ $py_version != $tag_version ]] ; then + echo "publish version does not match, $py_version vs $tag_version" + exit 1 + fi + + - name: build + run: | + poetry install + poetry build + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: | + ./openmldb_mixin/openmldb_dashboard.json +