From d4699f8b6ef4b312718e4948c2fa171caed319ca Mon Sep 17 00:00:00 2001 From: Dalton Date: Sat, 10 Feb 2024 17:36:29 -0600 Subject: [PATCH] Create build-release.yml --- .github/workflows/build-release.yml | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..a279784 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,71 @@ +name: Build and Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + 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: ${{ 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: + needs: release + strategy: + matrix: + include: + - os: windows-latest + BUILD_CMD: poetry run pyinstaller pyinstaller/PokeTerm.spec + OUT_FILENAME: PokeTerm.exe + UP_FILENAME: PokeTerm_Windows.exe + MIME_TYPE: application/vnd.microsoft.portable-executable + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create Release + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Setup Poetry + uses: abatilo/actions-poetry@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pyinstaller + poetry install + - name: Run PyInstaller + run: ${{ matrix.BUILD_CMD }} + - name: Load Release URL File from release job + uses: actions/download-artifact@v1 + with: + name: release_url + - name: 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: ./pyinstaller/dist/${{ matrix.OUT_FILENAME}} + asset_name: ${{ matrix.UP_FILENAME}} + asset_content_type: ${{ matrix.MIME_TYPE}}