name: CD on: push: branches: [main] tags: ['v[0-9]+.[0-9]+.[0-9]+'] jobs: test: timeout-minutes: 30 runs-on: windows-2019 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: 3.9 - run: .\scripts\test.ps1 lint: timeout-minutes: 30 runs-on: windows-2019 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: 3.9 - run: .\scripts\lint.ps1 build: timeout-minutes: 30 needs: [test, lint] runs-on: windows-2019 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: 3.9 - name: Build pyinstaller run: | python -m pip install --upgrade pip git clone --depth 1 --branch v4.1 https://github.com/pyinstaller/pyinstaller cd .\pyinstaller\bootloader\ python ./waf all cd .. python setup.py install - name: Build app run: | pyinstaller --onefile src\main.py --name ${{ github.event.repository.name }} --windowed --icon=logo.ico mv changelog.md dist mv installation.md dist tar -c -f ${{ github.event.repository.name }} -C dist * - name: Upload build artifact uses: actions/upload-artifact@v2 with: name: ${{ github.event.repository.name }}-${{ github.sha }} path: ${{ github.event.repository.name }} release: timeout-minutes: 30 needs: [build] runs-on: ubuntu-20.04 steps: - uses: actions/download-artifact@v2 with: name: ${{ github.event.repository.name }}-${{ github.sha }} - name: Prepare outputs id: env run: | name=${{ github.event.repository.name }} version=$(echo $GITHUB_REF | awk -F / '{print $3}') versioned_name="${name}.${version}.zip" mv ${{ github.event.repository.name }} $versioned_name echo ::set-output name=ASSET::$versioned_name - name: Create release for stable versions if: ${{ ! contains(github.ref, 'main') }} id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} - name: Upload assets for stable release id: upload-release-asset if: ${{ ! contains(github.ref, 'main') }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ steps.env.outputs.ASSET }} asset_name: ${{ steps.env.outputs.ASSET }} asset_content_type: application/zip - name: Upload assets for edge release if: ${{ contains(github.ref, 'main') }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ steps.env.outputs.ASSET }} asset_name: ${{ steps.env.outputs.ASSET }} tag: edge overwrite: true