From b40ab794a2472577b0ce8af5594ac140cd80c1a7 Mon Sep 17 00:00:00 2001 From: Martyx00 Date: Sat, 25 Sep 2021 16:20:23 +0200 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a124992 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,86 @@ +name: Build + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + + createrelease: + name: Create Release + runs-on: [ubuntu-latest] + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Output Release URL File + run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt + - name: Save Release URL File for publish + uses: actions/upload-artifact@v1 + with: + name: release_url + path: release_url.txt + + build: + name: Build packages + needs: createrelease + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + TARGET: macos + CMD_BUILD: cd collare/ && pyinstaller -n collare-macos --windowed --onefile --add-data=icons:icons --icon=icons/collare.ico collare.py + OUT_FILE_NAME: collare-macos + ASSET_MIME: application/x-mach-binary + - os: windows-latest + TARGET: windows + CMD_BUILD: cd collare/ && pyinstaller --windowed --onefile --add-data="icons;icons" --icon=icons/collare.ico collare.py + OUT_FILE_NAME: collare.exe + ASSET_MIME: application/vnd.microsoft.portable-executable + - os: ubuntu-latest + TARGET: linux + CMD_BUILD: cd collare/ && pyinstaller -n collare-linux --windowed --onefile --add-data=icons:icons --icon=icons/collare.ico collare.py + OUT_FILE_NAME: collare-linux + ASSET_MIME: application/x-elf + steps: + - uses: actions/checkout@v1 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + - name: Build with pyinstaller for ${{matrix.TARGET}} + run: ${{matrix.CMD_BUILD}} + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + - name: Get Release File Name & Upload URL + id: get_release_info + shell: bash + run: | + value=`cat release_url/release_url.txt` + echo ::set-output name=upload_url::$value + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./collare/dist/${{ matrix.OUT_FILE_NAME}} + asset_name: ${{ matrix.OUT_FILE_NAME}} + asset_content_type: ${{ matrix.ASSET_MIME}}