Update workflow #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python application | |
on: | |
push: | |
branches: | |
- release/* | |
pull_request: | |
permissions: | |
contents: write | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: winterjung/split@v2 | |
id: split | |
with: | |
msg: ${{ github.ref_name }} | |
separator: '/' | |
- name: Save version to file | |
run: echo ${{ steps.split.outputs._1 }} > version.txt | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: version.txt | |
path: version.txt | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
merge-multiple: true | |
- name: Load version from file | |
id: version | |
shell: bash | |
run: | | |
content=`cat version.txt/version.txt` | |
echo "::set-output name=version::$content" | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r adbgateway/requirements.txt | |
pip install pyinstaller | |
- name: Build | |
run: pyinstaller adbgateway.spec | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-${{ steps.version.outputs.version }} | |
path: dist/adbgateway | |
build-windows: | |
needs: get-version | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
merge-multiple: true | |
- name: Load version from file | |
id: version | |
shell: bash | |
run: | | |
content=`cat version.txt/version.txt` | |
echo "::set-output name=version::$content" | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r adbgateway/requirements.txt | |
pip install pyinstaller pyinstaller-versionfile | |
- name: Generate version file | |
run: create-version-file metadata.yaml --outfile file_info.txt --version ${{ steps.version.outputs.version }} | |
- name: Build | |
run: pyinstaller adbgateway.spec | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows-${{ steps.version.outputs.version }}.exe | |
path: dist/adbgateway.exe | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-windows] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- name: Load version from file | |
id: version | |
shell: bash | |
run: | | |
content=`cat artifacts/version.txt` | |
echo "::set-output name=version::$content" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
tag_name: ${{ steps.version.outputs.version }} | |
name: ${{ steps.version.outputs.version }} | |
files: | | |
artifacts/linux-${{ steps.version.outputs.version }} | |
artifacts/windows-${{ steps.version.outputs.version }}.exe | |