File size: 1,684 Bytes
b585c7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build & Publish h2oGPT Python wheel to PYPI

on:
  workflow_dispatch:
    inputs:
      pypi-index:
        type: choice
        description: PyPI index that needed to be published
        required: true
        default: Test-PyPI
        options:
          - PyPI
          - Test-PyPI
      version:
        description: |
          Override the current version for the python package for dev purposes when uploading to Test-PyPI
        type: string

jobs:
  build_and_upload:
    runs-on: ubuntu-latest
    steps:
        - uses: actions/checkout@v3.5.3

        - uses: actions/setup-python@v4
          with:
            python-version: '3.10'
        
        - name: Install Dependencies
          run: |
            python3.10 -m pip install --upgrade pip
            python3.10 -m pip install setuptools wheel twine --upgrade
        
        - name: Modify Version
          if: ${{ inputs.version != ''}}
          run: |
            echo ${{ inputs.version}} > version.txt
            echo "h2ogpt-wheel-version  = $(cat version.txt)"
        
        - name: Build Wheel
          run: make clean dist
        
        - name: Publish to Test-PyPI
          if: ${{ inputs.pypi-index == 'Test-PyPI' }}
          run: |
            twine upload -r testpypi dist/*
          env:
            TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}  
            TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        
        - name: Publish to PyPI
          if: ${{ inputs.pypi-index == 'PyPI' }}
          run: |
            twine upload dist/*
          env:
            TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}  
            TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}