|
| 1 | +# This workflow will upload a Python Package using Twine when a release is created |
| 2 | +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
| 3 | + |
| 4 | +name: Upload Python Package |
| 5 | + |
| 6 | +on: |
| 7 | + release: |
| 8 | + types: [created] |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + build: |
| 13 | + |
| 14 | + runs-on: ubuntu-18.04 |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + with: |
| 22 | + python-version: '3.7' |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install -r requirements.txt |
| 27 | + |
| 28 | + - name: PyInstaller Windows |
| 29 | + uses: JackMcKew/pyinstaller-action-windows@main |
| 30 | + with: |
| 31 | + path: ./ |
| 32 | + |
| 33 | + - name : Zip release file |
| 34 | + run: zip -rj ./fosslight_dependency_windows.zip dist/windows/fosslight_dependency.exe ./LICENSES/3rd_party_licenses.txt ./LICENSE |
| 35 | + |
| 36 | + - name: Upload release file |
| 37 | + |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + with: |
| 41 | + upload_url: ${{ github.event.release.upload_url }} |
| 42 | + asset_path: ./fosslight_dependency_windows.zip |
| 43 | + asset_name: fosslight_dependency_windows.zip |
| 44 | + asset_content_type: application/zip |
| 45 | + |
| 46 | + deploy: |
| 47 | + |
| 48 | + runs-on: ubuntu-18.04 |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@v2 |
| 54 | + with: |
| 55 | + python-version: '3.7' |
| 56 | + - name: Install dependencies |
| 57 | + run: | |
| 58 | + python -m pip install --upgrade pip |
| 59 | + pip install setuptools wheel twine |
| 60 | + - name: Build and publish |
| 61 | + env: |
| 62 | + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 63 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 64 | + run: | |
| 65 | + python setup.py sdist bdist_wheel |
| 66 | + twine upload dist/* |
0 commit comments