From 115bcc0b416cd050326cbd6e42b1cc00a8053a82 Mon Sep 17 00:00:00 2001 From: FrankLeeeee Date: Mon, 28 Feb 2022 07:17:37 +0000 Subject: [PATCH] added pypi publication CI and remove formatting CI --- .github/workflows/PR_CI.yml | 39 ----------------------------------- .github/workflows/release.yml | 26 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/PR_CI.yml b/.github/workflows/PR_CI.yml index 7dccfbecd..4bdd6b8b0 100644 --- a/.github/workflows/PR_CI.yml +++ b/.github/workflows/PR_CI.yml @@ -49,42 +49,3 @@ jobs: pytest tests env: DATA: /data/scratch/cifar-10 - - format_check: - name: Format Check - if: github.event.pull_request.draft == false && github.base_ref == 'main' && github.head_ref == 'develop' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI' - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - - name: autoyapf - id: autoyapf - uses: mritunjaysharma394/autoyapf@v2 - with: - args: --style google --recursive --in-place . - - - name: Check for modified files - id: git-check - run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) - - - name: Push changes - if: steps.git-check.outputs.modified == 'true' - run: | - git config --global user.name 'github-actions' - git config --global user.email 'github-actions@github.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git commit -am "Automated autoyapf fixes" - - - name: Create Pull Request - # if: steps.format.outputs.has-changes == 'true' - uses: peter-evans/create-pull-request@v3 - with: - title: '[Bot] Automated PR to fix formatting errors' - body: | - Automated PR to fix formatting errors - committer: GitHub - author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - assignees: ${{ github.actor }} - reviewers: frankleeeee diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..46b0072df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Publish to PyPI +on: workflow_dispatch + +jobs: + build-n-publish: + if: (github.base_ref == 'main' || github.base_ref == 'develop') && github.repository == 'hpcaitech/ColossalAI' && contains('["FrankLeeeee", "ver217", "feifeibear", "kurisusnowdeng"]', github.actor) + name: Build and publish Python 🐍 distributions 📦 to PyPI or Test PyPI + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + # publish to PyPI if executed on the main branch + # publish to Test PyPI if executed on the develop branch + - name: Publish package to Test PyPI + if: github.base_ref == 'develop' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + - name: Publish package to PyPI + if: github.base_ref == 'main' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}