Skip to content

Commit 7dc4eed

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

File tree

5 files changed

+213
-1
lines changed

5 files changed

+213
-1
lines changed

.github/workflows/main.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
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+
package-path: ${{ env.CORE_LOVE_PACKAGE_PATH }}
69+
- name: Rename love package
70+
run: |
71+
mkdir -p ${{ env.OUTPUT_FOLDER }}
72+
mv ${{ env.CORE_LOVE_PACKAGE_PATH }} ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love
73+
- name: Upload artifact
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: ${{ needs.get-info.outputs.base-name }}_Core_love
77+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love
78+
- name: Prepare for release
79+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
80+
shell: bash
81+
run: |
82+
mkdir -p ${{ env.RELEASE_FOLDER }}
83+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.love ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love
84+
- name: Upload release
85+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
86+
uses: ncipollo/release-action@v1
87+
with:
88+
allowUpdates: true
89+
artifacts: ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Bare.love
90+
body: ${{ needs.get-info.outputs.update-note }}
91+
name: ${{ needs.get-info.outputs.update-title }}
92+
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
93+
94+
build-linux:
95+
runs-on: ubuntu-latest
96+
needs: [get-info, build-core]
97+
env:
98+
OUTPUT_FOLDER: ./build
99+
RELEASE_FOLDER: ./release
100+
steps:
101+
- uses: actions/checkout@v3
102+
with:
103+
submodules: recursive
104+
- name: Process app name
105+
id: process-app-name
106+
shell: python3 {0}
107+
run: |
108+
import os
109+
import re
110+
111+
product_name = re.sub(r'[^A-Za-z0-9]+', '-', '${{ needs.get-info.outputs.app-name }}').strip('-').lower()
112+
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
113+
f.write('bundle-id=org.26f-studio.' + product_name + '\n')
114+
f.write('product-name=' + product_name + '\n')
115+
- name: Download core love package
116+
uses: actions/download-artifact@v3
117+
with:
118+
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
119+
- name: Build Linux packages
120+
id: build-packages
121+
uses: love-actions/love-actions-linux@v1
122+
with:
123+
app-name: ${{ needs.get-info.outputs.app-name }}
124+
version-string: ${{ needs.get-info.outputs.version }}
125+
icon-path: ./resources/graphics/icon.png
126+
love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }}
127+
product-name: ${{ steps.process-app-name.outputs.product-name }}
128+
output-folder: ${{ env.OUTPUT_FOLDER }}
129+
- name: Upload AppImage artifact
130+
uses: actions/upload-artifact@v3
131+
with:
132+
name: ${{ needs.get-info.outputs.base-name }}_Linux_AppImage
133+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage
134+
- name: Prepare for release
135+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
136+
shell: bash
137+
run: |
138+
mkdir -p ${{ env.RELEASE_FOLDER }}
139+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.AppImage ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage
140+
cp ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}.deb ${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb
141+
- name: Upload release
142+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
143+
uses: ncipollo/release-action@v1
144+
with:
145+
allowUpdates: true
146+
artifacts: |
147+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage
148+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.deb
149+
body: ${{ needs.get-info.outputs.update-note }}
150+
name: ${{ needs.get-info.outputs.update-title }}
151+
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
152+
153+
build-windows:
154+
runs-on: windows-latest
155+
needs: [get-info, build-core]
156+
env:
157+
OUTPUT_FOLDER: ./build
158+
RELEASE_FOLDER: ./release
159+
steps:
160+
- uses: actions/checkout@v3
161+
with:
162+
submodules: recursive
163+
- name: Process app name
164+
id: process-app-name
165+
shell: python3 {0}
166+
run: |
167+
import os
168+
import re
169+
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
170+
f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n')
171+
- name: Download core love package
172+
uses: actions/download-artifact@v3
173+
with:
174+
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
175+
- name: Build Windows packages
176+
id: build-packages
177+
uses: love-actions/love-actions-windows@v1
178+
with:
179+
icon-path: ./resources/graphics/icon.ico
180+
love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }}
181+
product-name: ${{ steps.process-app-name.outputs.product-name }}
182+
output-folder: ${{ env.OUTPUT_FOLDER }}
183+
- name: Upload 32-bit artifact
184+
uses: actions/upload-artifact@v3
185+
with:
186+
name: ${{ needs.get-info.outputs.base-name }}_Windows_x86
187+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip
188+
- name: Upload 64-bit artifact
189+
uses: actions/upload-artifact@v3
190+
with:
191+
name: ${{ needs.get-info.outputs.base-name }}_Windows_x64
192+
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip
193+
- name: Prepare for release
194+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
195+
shell: bash
196+
run: |
197+
mkdir -p ${{ env.RELEASE_FOLDER }}
198+
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
199+
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
200+
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
201+
- name: Upload release
202+
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
203+
uses: ncipollo/release-action@v1
204+
with:
205+
allowUpdates: true
206+
artifacts: |
207+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip
208+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip
209+
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_installer.exe
210+
body: ${{ needs.get-info.outputs.update-note }}
211+
name: ${{ needs.get-info.outputs.update-title }}
212+
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.ico

3.55 KB
Binary file not shown.

resources/graphics/icon.jpg

-1.39 KB
Binary file not shown.

resources/graphics/icon.png

1.71 KB
Loading

0 commit comments

Comments
 (0)