Skip to content

Commit 929fc6f

Browse files
committed
Start building releases in Github Actions
convert icon.jpg to icon.png
1 parent 58966c7 commit 929fc6f

File tree

5 files changed

+219
-1
lines changed

5 files changed

+219
-1
lines changed

.github/build components/icon.ico

3.55 KB
Binary file not shown.

.github/workflows/main.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: BYTEPATH CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: [pre*, v*]
7+
pull_request:
8+
9+
env:
10+
BUILD_TYPE: ${{ fromJSON('["dev", "release"]')[startsWith(github.ref, 'refs/tags/v')] }}
11+
CORE_LOVE_PACKAGE_PATH: ./core.love
12+
CORE_LOVE_ARTIFACT_NAME: BYTEPATH_love_package
13+
14+
jobs:
15+
get-info:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
app-name: ${{ steps.app-info.outputs.app-name }}
19+
version: ${{ steps.app-info.outputs.version }}
20+
commit-hash: ${{ steps.git-info.outputs.commit-hash }}
21+
base-name: ${{ steps.assemble-base-name.outputs.base-name }}
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Install lua
25+
run: |
26+
sudo apt-get install lua5.1 -y
27+
- name: Get app info
28+
id: app-info
29+
shell: lua {0}
30+
run: |
31+
local version = require "version"
32+
os.execute('echo "app-name=BYTEPATH" >> $GITHUB_OUTPUT')
33+
os.execute('echo "version=' .. version .. '" >> $GITHUB_OUTPUT')
34+
- name: Get git info
35+
id: git-info
36+
shell: bash
37+
run: |
38+
COMMIT_HASH=$(git rev-parse --short ${{ GITHUB.SHA }})
39+
echo "commit-hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
40+
- name: Assemble package base name
41+
id: assemble-base-name
42+
shell: bash
43+
run: |
44+
BASE_NAME=BYTEPATH_${{ steps.app-info.outputs.version }}_${{ steps.git-info.outputs.commit-hash }}_#${{ GITHUB.RUN_NUMBER }}
45+
echo "base-name=$BASE_NAME" >> $GITHUB_OUTPUT
46+
47+
build-core:
48+
runs-on: ubuntu-latest
49+
needs: get-info
50+
env:
51+
OUTPUT_FOLDER: ./build
52+
RELEASE_FOLDER: ./release
53+
steps:
54+
- uses: actions/checkout@v3
55+
with:
56+
submodules: recursive
57+
- name: Process app name
58+
id: process-app-name
59+
shell: python3 {0}
60+
run: |
61+
import os
62+
import re
63+
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
64+
f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n')
65+
- name: Build core love package
66+
uses: love-actions/love-actions-core@v1
67+
with:
68+
build-list: "*.lua LICENSE README.md libraries objects resources rooms"
69+
package-path: ${{ env.CORE_LOVE_PACKAGE_PATH }}
70+
- name: Upload core love package
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
74+
path: ${{ env.CORE_LOVE_PACKAGE_PATH }}
75+
- name: Rename love package
76+
run: |
77+
mkdir -p ${{ env.OUTPUT_FOLDER }}
78+
mv ${{ env.CORE_LOVE_PACKAGE_PATH }} ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love
79+
- name: Upload artifact
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: ${{ needs.get-info.outputs.base-name }}_Core_love
83+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love
84+
- name: Prepare for release
85+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
86+
shell: bash
87+
run: |
88+
mkdir -p ${{ env.RELEASE_FOLDER }}
89+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love
90+
- name: Upload release
91+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
92+
uses: ncipollo/release-action@v1
93+
with:
94+
allowUpdates: true
95+
artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love
96+
body: ${{ needs.get-info.outputs.update-note }}
97+
name: ${{ needs.get-info.outputs.update-title }}
98+
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
99+
100+
build-linux:
101+
runs-on: ubuntu-latest
102+
needs: [get-info, build-core]
103+
env:
104+
OUTPUT_FOLDER: ./build
105+
RELEASE_FOLDER: ./release
106+
steps:
107+
- uses: actions/checkout@v3
108+
with:
109+
submodules: recursive
110+
- name: Process app name
111+
id: process-app-name
112+
shell: python3 {0}
113+
run: |
114+
import os
115+
import re
116+
117+
product_name = re.sub(r'[^A-Za-z0-9]+', '-', '${{ needs.get-info.outputs.app-name }}').strip('-').lower()
118+
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
119+
f.write('bundle-id=org.26f-studio.' + product_name + '\n')
120+
f.write('product-name=' + product_name + '\n')
121+
- name: Download core love package
122+
uses: actions/download-artifact@v3
123+
with:
124+
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
125+
- name: Build Linux packages
126+
id: build-packages
127+
uses: love-actions/love-actions-linux@v1
128+
with:
129+
app-name: ${{ needs.get-info.outputs.app-name }}
130+
version-string: ${{ needs.get-info.outputs.version }}
131+
icon-path: ./resources/graphics/icon.png
132+
love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }}
133+
product-name: ${{ steps.process-app-name.outputs.product-name }}
134+
output-folder: ${{ env.OUTPUT_FOLDER }}
135+
- name: Upload AppImage artifact
136+
uses: actions/upload-artifact@v3
137+
with:
138+
name: ${{ needs.get-info.outputs.base-name }}_Linux_AppImage
139+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage
140+
- name: Prepare for release
141+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
142+
shell: bash
143+
run: |
144+
mkdir -p ${{ env.RELEASE_FOLDER }}
145+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage
146+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.deb ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb
147+
- name: Upload release
148+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
149+
uses: ncipollo/release-action@v1
150+
with:
151+
allowUpdates: true
152+
artifacts: |
153+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage
154+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb
155+
body: ${{ needs.get-info.outputs.update-note }}
156+
name: ${{ needs.get-info.outputs.update-title }}
157+
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
158+
159+
build-windows:
160+
runs-on: windows-latest
161+
needs: [get-info, build-core]
162+
env:
163+
OUTPUT_FOLDER: ./build
164+
RELEASE_FOLDER: ./release
165+
steps:
166+
- uses: actions/checkout@v3
167+
with:
168+
submodules: recursive
169+
- name: Process app name
170+
id: process-app-name
171+
shell: python3 {0}
172+
run: |
173+
import os
174+
import re
175+
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
176+
f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n')
177+
- name: Download core love package
178+
uses: actions/download-artifact@v3
179+
with:
180+
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
181+
- name: Build Windows packages
182+
id: build-packages
183+
uses: love-actions/love-actions-windows@v1
184+
with:
185+
icon-path: ./.github/build components/icon.ico
186+
love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }}
187+
product-name: ${{ steps.process-app-name.outputs.product-name }}
188+
output-folder: ${{ env.OUTPUT_FOLDER }}
189+
- name: Upload 32-bit artifact
190+
uses: actions/upload-artifact@v3
191+
with:
192+
name: ${{ needs.get-info.outputs.base-name }}_Windows_x86
193+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip
194+
- name: Upload 64-bit artifact
195+
uses: actions/upload-artifact@v3
196+
with:
197+
name: ${{ needs.get-info.outputs.base-name }}_Windows_x64
198+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip
199+
- name: Prepare for release
200+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
201+
shell: bash
202+
run: |
203+
mkdir -p ${{ env.RELEASE_FOLDER }}
204+
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
205+
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
206+
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
207+
- name: Upload release
208+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
209+
uses: ncipollo/release-action@v1
210+
with:
211+
allowUpdates: true
212+
artifacts: |
213+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip
214+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip
215+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_installer.exe
216+
body: ${{ needs.get-info.outputs.update-note }}
217+
name: ${{ needs.get-info.outputs.update-title }}
218+
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}

main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require 'tree'
2727
-- https://hc.readthedocs.io/en/latest/SpatialHash.html#Spatialhash
2828
HC.hash().cell_size = 25
2929

30-
if not love.window.setIcon(love.image.newImageData("resources/graphics/icon.jpg")) then
30+
if not love.window.setIcon(love.image.newImageData("resources/graphics/icon.png")) then
3131
print(string.format('icon failed to load\n'))
3232
end
3333

resources/graphics/icon.jpg

-1.39 KB
Binary file not shown.

resources/graphics/icon.png

1.71 KB
Loading

0 commit comments

Comments
 (0)