colossalai

Форк
0
/
release_pypi_after_merge.yml 
68 строк · 1.9 Кб
1
name: Publish to PyPI
2

3
on:
4
  workflow_dispatch:
5
  pull_request:
6
    paths:
7
      - 'version.txt'
8
    types:
9
      - closed
10

11
jobs:
12
  build-n-publish:
13
    if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI' && github.event.pull_request.merged == true && github.base_ref == 'main'
14
    name: Build and publish Python 🐍 distributions 📦 to PyPI
15
    runs-on: ubuntu-latest
16
    timeout-minutes: 20
17
    steps:
18
    - uses: actions/checkout@v2
19

20
    - uses: actions/setup-python@v2
21
      with:
22
        python-version: '3.8.14'
23

24
    - run: python setup.py sdist build
25

26
    # publish to PyPI if executed on the main branch
27
    - name: Publish package to PyPI
28
      id: publish
29
      uses: pypa/gh-action-pypi-publish@release/v1
30
      with:
31
        user: __token__
32
        password: ${{ secrets.PYPI_API_TOKEN }}
33
        verbose: true
34

35
  notify:
36
    name: Notify Lark via webhook
37
    needs: build-n-publish
38
    runs-on: ubuntu-latest
39
    if: ${{ always() }}
40
    steps:
41
      - uses: actions/checkout@v2
42

43
      - uses: actions/setup-python@v2
44
        with:
45
          python-version: '3.8.14'
46

47
      - name: Install requests
48
        run: pip install requests
49

50
      - name: Notify Lark
51
        id: message-preparation
52
        run: |
53
          url=$SERVER_URL/$REPO/actions/runs/$RUN_ID
54

55
          if [ "$STATUS" == 'success' ]
56
          then
57
            msg="The Colossal-AI latest version has been successfully released to PyPI."
58
          else
59
            msg="Failed to release Colossal-AI to PyPI, please visit $url for details."
60
          fi
61
          echo $msg
62
          python .github/workflows/scripts/send_message_to_lark.py -m "$msg" -u $WEBHOOK_URL
63
        env:
64
          SERVER_URL: ${{github.server_url }}
65
          REPO: ${{ github.repository }}
66
          RUN_ID: ${{ github.run_id }}
67
          WEBHOOK_URL: ${{ secrets.LARK_NOTIFICATION_WEBHOOK_URL }}
68
          STATUS: ${{ needs.build-n-publish.result }}
69

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.