|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: release |
| 4 | + |
| 5 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 6 | +# events but only for the master branch |
| 7 | +on: |
| 8 | + release: |
| 9 | + types: [published] |
| 10 | + # Allows you to run this workflow manually from the Actions tab |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 14 | +jobs: |
| 15 | + # This workflow contains a single job called "build" |
| 16 | + build: |
| 17 | + name: release and upload assets task |
| 18 | + # The type of runner that the job will run on |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + python-version: ["3.9"] # must use str, not int, or 3.10 will be recognized as 3.1 |
| 22 | + os: [ubuntu-latest, macos-latest] |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 25 | + steps: |
| 26 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 27 | + - name: checkout code from github |
| 28 | + uses: actions/checkout@v2 |
| 29 | + |
| 30 | + - name: Set up Python |
| 31 | + uses: actions/setup-python@v2 |
| 32 | + with: |
| 33 | + python-version: ${{ matrix.python-version }} |
| 34 | + |
| 35 | + # Runs a set of commands using the runners shell |
| 36 | + - name: pack |
| 37 | + id: pack |
| 38 | + run: | |
| 39 | + python --version |
| 40 | + export QT_DEBUG_PLUGINS=1 |
| 41 | + sudo apt-get update |
| 42 | + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y x11-utils libxkbcommon-x11-0 |
| 43 | + pip3 install -r requirements.txt |
| 44 | + pip3 install pyinstaller wheel |
| 45 | + python setup.py sdist bdist_wheel |
| 46 | + python pack.py |
| 47 | + release_path=`python pack.py ${{ matrix.os }}` |
| 48 | + echo $release_path |
| 49 | + release_name=`echo $release_path | awk -F"/" '{print $NF}'` |
| 50 | + echo ::set-output name=release_path::$release_path |
| 51 | + echo ::set-output name=release_name::$release_name |
| 52 | + - name: Upload to release |
| 53 | + uses: svenstaro/upload-release-action@v2 |
| 54 | + with: |
| 55 | + file: ${{ steps.pack.outputs.release_path }} |
| 56 | + asset_name: ${{ steps.pack.outputs.release_name }} |
| 57 | + tag: ${{ github.ref }} |
| 58 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + |
0 commit comments