From b710cb663fcd5fb0a6632d1dd269b66424cbc234 Mon Sep 17 00:00:00 2001 From: RunningDroid Date: Wed, 24 May 2023 02:38:44 -0400 Subject: [PATCH] Start building releases in Github Actions convert icon.jpg to icon.png --- .github/workflows/main.yml | 222 ++++++++++++++++++++++++++++++++++++ main.lua | 2 +- resources/graphics/icon.ico | Bin 0 -> 3638 bytes resources/graphics/icon.jpg | Bin 1425 -> 0 bytes resources/graphics/icon.png | Bin 0 -> 1750 bytes 5 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml create mode 100644 resources/graphics/icon.ico delete mode 100644 resources/graphics/icon.jpg create mode 100644 resources/graphics/icon.png diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..1baad38 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,222 @@ +name: BYTEPATH CI + +on: + push: + branches: [main] + tags: [pre*, v*] + pull_request: + +env: + BUILD_TYPE: ${{ fromJSON('["dev", "release"]')[startsWith(github.ref, 'refs/tags/v')] }} + CORE_LOVE_PACKAGE_PATH: ./core.love + CORE_LOVE_ARTIFACT_NAME: core_love_package + +jobs: + get-info: + runs-on: ubuntu-latest + outputs: + app-name: ${{ steps.app-info.outputs.app-name }} + version: ${{ steps.app-info.outputs.version }} + commit-hash: ${{ steps.git-info.outputs.commit-hash }} + base-name: ${{ steps.assemble-base-name.outputs.base-name }} + steps: + - uses: actions/checkout@v3 + - name: Install lua + run: | + sudo apt-get install lua5.1 -y + - name: Get app info + id: app-info + shell: lua {0} + run: | + local version = require "version" + os.execute('echo "app-name=BYTEPATH" >> $GITHUB_OUTPUT') + os.execute('echo "version=' .. version .. '" >> $GITHUB_OUTPUT') + - name: Get git info + id: git-info + shell: bash + run: | + COMMIT_HASH=$(git rev-parse --short ${{ GITHUB.SHA }}) + echo "commit-hash=$COMMIT_HASH" >> $GITHUB_OUTPUT + - name: Assemble package base name + id: assemble-base-name + shell: bash + run: | + BASE_NAME=BYTEPATH_${{ steps.app-info.outputs.version }}_${{ steps.git-info.outputs.commit-hash }}_#${{ GITHUB.RUN_NUMBER }} + echo "base-name=$BASE_NAME" >> $GITHUB_OUTPUT + + build-core: + runs-on: ubuntu-latest + needs: get-info + env: + OUTPUT_FOLDER: ./build + RELEASE_FOLDER: ./release + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Process app name + id: process-app-name + shell: python3 {0} + run: | + import os + import re + with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: + f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') + - name: Build core love package + uses: love-actions/love-actions-core@v1 + with: + package-path: ${{ env.CORE_LOVE_PACKAGE_PATH }} + - name: Upload core love package + uses: actions/upload-artifact@v3 + with: + name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} + path: ${{ env.CORE_LOVE_PACKAGE_PATH }} + - name: Rename love package + run: | + mkdir -p ${{ env.OUTPUT_FOLDER }} + mv ${{ env.CORE_LOVE_PACKAGE_PATH }} ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.get-info.outputs.base-name }}_Core_love + path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love + - name: Prepare for release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + shell: bash + run: | + mkdir -p ${{ env.RELEASE_FOLDER }} + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love + - name: Upload release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love + body: ${{ needs.get-info.outputs.update-note }} + name: ${{ needs.get-info.outputs.update-title }} + prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} + + build-linux: + runs-on: ubuntu-latest + needs: [get-info, build-core] + env: + OUTPUT_FOLDER: ./build + RELEASE_FOLDER: ./release + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Process app name + id: process-app-name + shell: python3 {0} + run: | + import os + import re + + product_name = re.sub(r'[^A-Za-z0-9]+', '-', '${{ needs.get-info.outputs.app-name }}').strip('-').lower() + with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: + f.write('bundle-id=org.26f-studio.' + product_name + '\n') + f.write('product-name=' + product_name + '\n') + - name: Download core love package + uses: actions/download-artifact@v3 + with: + name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} + - name: Build Linux packages + id: build-packages + uses: love-actions/love-actions-linux@v1 + with: + app-name: ${{ needs.get-info.outputs.app-name }} + version-string: ${{ needs.get-info.outputs.version }} + icon-path: ./resources/graphics/icon.png + love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} + product-name: ${{ steps.process-app-name.outputs.product-name }} + output-folder: ${{ env.OUTPUT_FOLDER }} + - name: Upload AppImage artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.get-info.outputs.base-name }}_Linux_AppImage + path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage + - name: Prepare for release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + shell: bash + run: | + mkdir -p ${{ env.RELEASE_FOLDER }} + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.deb ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb + - name: Upload release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: | + ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage + ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb + body: ${{ needs.get-info.outputs.update-note }} + name: ${{ needs.get-info.outputs.update-title }} + prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} + + build-windows: + runs-on: windows-latest + needs: [get-info, build-core] + env: + OUTPUT_FOLDER: ./build + RELEASE_FOLDER: ./release + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Process app name + id: process-app-name + shell: python3 {0} + run: | + import os + import re + with open(os.getenv('GITHUB_OUTPUT'), 'a') as f: + f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n') + - name: Download core love package + uses: actions/download-artifact@v3 + with: + name: ${{ env.CORE_LOVE_ARTIFACT_NAME }} + - name: Build Windows packages + id: build-packages + uses: love-actions/love-actions-windows@v1 + with: + icon-path: ./.github/build/icon.ico + love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }} + product-name: ${{ steps.process-app-name.outputs.product-name }} + output-folder: ${{ env.OUTPUT_FOLDER }} + - name: Upload 32-bit artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.get-info.outputs.base-name }}_Windows_x86 + path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip + - name: Upload 64-bit artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.get-info.outputs.base-name }}_Windows_x64 + path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip + - name: Upload installer artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ needs.get-info.outputs.base-name }}_Windows_installer + path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_installer.exe + - name: Prepare for release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + shell: bash + run: | + mkdir -p ${{ env.RELEASE_FOLDER }} + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip + cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_installer.exe ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_installer.exe + - name: Upload release + if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }} + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: | + ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip + ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip + ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_installer.exe + body: ${{ needs.get-info.outputs.update-note }} + name: ${{ needs.get-info.outputs.update-title }} + prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} diff --git a/main.lua b/main.lua index 82ecd86..4e5753e 100644 --- a/main.lua +++ b/main.lua @@ -27,7 +27,7 @@ require 'tree' -- https://hc.readthedocs.io/en/latest/SpatialHash.html#Spatialhash HC.hash().cell_size = 25 -if not love.window.setIcon(love.image.newImageData("resources/graphics/icon.jpg")) then +if not love.window.setIcon(love.image.newImageData("resources/graphics/icon.png")) then print(string.format('icon failed to load\n')) end diff --git a/resources/graphics/icon.ico b/resources/graphics/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..04cdf4d4a098aff326a48c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niJjnf3N+` lU;w(gbbl1Xv~%|!eS0UN(B_#o@z5d#m5u5PL>T|y1OURRTN?lX diff --git a/resources/graphics/icon.png b/resources/graphics/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..e81c99eaec91c70c90bdd7569d72d9d887ffa142 GIT binary patch literal 1750 zcmZ{kc{JOJ7RP@HA+(4$sCw44^-xO^Yhq~-8Vs+DrL`uuQVAwO5G^f5o0N9O5XI;l zRBA}+RCQ8YHI&+`(x9Yjnby)a5<@M|OV2y!z4QKf_nv#d=YH?`ocrIscE;zllA@L( z002rJc$}Y9^}iMrEbV)m>os48D7>FH0Av~hKu#V2>`1Mg_W+QJ0Du(&0AN@Ea3r~s z>+2w0$VGac#sLRk^G-+ok5We=8Gnun0Lp@|1(L_#x(fi1haNa*fBf^hz`-J&AoZ}_ z?{xzv+umGU;H@kBOp{+0sn-~F&VP}I5e*MpE>3KNmXF@S2fEY->i(q#a_gFs^DOJp zMd7BMikurKm<6(J^wp{Q?e+BT+IQ28k8>S#3WbuH=_!QQ$>tO`D^W%O7CM`;zrQ~a z4IfD0CC4Qd9NyQA`A?>J8^D;&+7!Jnb@{0|&$P)*}Y^91q_Eu-Sma2!b z>aB*vm3?I`zy*rq4FT<2&HQi&Bq{4WLfpI3)Y{O1?DH-tcvD41_BFBHYRMt0NAYrO z6DHE)XI=9PC-+{%qL|8CPVGJcG0Tt01szSY`Og93HZFFjgZqOKwvPYZwW_NM&BP`{w<`O)AXX*bgcS`%TDSD zoRhqPSKMPsL0Az6$73N`{O+#SB3UaIwA+N@qwy>;o}drKP9 z_AX&YF0TaphsjG$l=}w%d1sA75q*@@vqI{P9blC~<91MucWi7oO>@WGYt^|+=t%I7 z$i9pPewgC#qx$f$=Be>1IRE2>aLytdb3-f=RaHQ1y0Rq1BGLAr_Ckl91aWPWqA_j9 z=8=228F!T4K7K@;Xpr8zJFp%0gP_31&~44KOeD;%Fo+dA^t7hTaKZGk-22;%6r(jML%nVUbETE%6`f zpQdU)3A->GU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