Skip to content

Commit 4395f4d

Browse files
committed
rework CI to use release.sh
1 parent 736aab2 commit 4395f4d

File tree

2 files changed

+33
-189
lines changed

2 files changed

+33
-189
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -2,214 +2,53 @@ name: BYTEPATH CI
22

33
on:
44
push:
5-
branches: [main]
6-
tags: [pre*, v*]
5+
tags: '*'
76
pull_request:
87

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-
148
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:
9+
build:
4810
runs-on: ubuntu-latest
49-
needs: get-info
5011
env:
5112
OUTPUT_FOLDER: ./build
52-
RELEASE_FOLDER: ./release
5313
steps:
5414
- uses: actions/checkout@v3
5515
with:
5616
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
17+
- name: Build artfacts
18+
run: ./release.sh
19+
- name: Prepare Artifact Names
20+
run: |
21+
echo "::set-env name=ARTIFACT_NAME_LOVE::$(find build -iname '*.love' -printf '%f\n')"
22+
echo "::set-env name=ARTIFACT_NAME_WIN32::$(find build -iname '*win32*' -printf '%f\n')"
23+
echo "::set-env name=ARTIFACT_NAME_DEFAULT_APPIMAGE::$(find build -iname 'BYTEPATH*.AppImage' -printf '%f\n')"
24+
echo "::set-env name=ARTIFACT_NAME_DROP-IN_APPIMAGE::$(find build -iname 'game*.AppImage' -printf '%f\n')"
25+
- name: Upload Artifact (love)
26+
if: ${{ !github.event.act }} # skip during local actions testing
7127
uses: actions/upload-artifact@v3
7228
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
29+
name: ${{ env.ARTIFACT_NAME_LOVE }}
30+
path: build/${{ env.ARTIFACT_NAME_LOVE }}
31+
- name: Upload Artifact (win32)
32+
if: ${{ !github.event.act }} # skip during local actions testing
8033
uses: actions/upload-artifact@v3
8134
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-
- name: Upload release
147-
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
148-
uses: ncipollo/release-action@v1
149-
with:
150-
allowUpdates: true
151-
artifacts: |
152-
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Linux.AppImage
153-
body: ${{ needs.get-info.outputs.update-note }}
154-
name: ${{ needs.get-info.outputs.update-title }}
155-
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
156-
157-
build-windows:
158-
runs-on: windows-latest
159-
needs: [get-info, build-core]
160-
env:
161-
OUTPUT_FOLDER: ./build
162-
RELEASE_FOLDER: ./release
163-
steps:
164-
- uses: actions/checkout@v3
165-
with:
166-
submodules: recursive
167-
- name: Process app name
168-
id: process-app-name
169-
shell: python3 {0}
170-
run: |
171-
import os
172-
import re
173-
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
174-
f.write('product-name=' + re.sub(r'[^A-Za-z0-9]+', '_', '${{ needs.get-info.outputs.app-name }}') + '\n')
175-
- name: Download core love package
176-
uses: actions/download-artifact@v3
177-
with:
178-
name: ${{ env.CORE_LOVE_ARTIFACT_NAME }}
179-
- name: Build Windows packages
180-
id: build-packages
181-
uses: love-actions/love-actions-windows@v1
182-
with:
183-
icon-path: ./.github/buildbits/icon.ico
184-
love-package: ${{ env.CORE_LOVE_PACKAGE_PATH }}
185-
product-name: ${{ steps.process-app-name.outputs.product-name }}
186-
output-folder: ${{ env.OUTPUT_FOLDER }}
187-
- name: Upload 32-bit artifact
35+
name: ${{ env.ARTIFACT_NAME_WIN32 }}
36+
path: build/${{ env.ARTIFACT_NAME_WIN32 }}
37+
- name: Upload artifact
38+
if: ${{ !github.event.act }} # skip during local actions testing
18839
uses: actions/upload-artifact@v3
18940
with:
190-
name: ${{ needs.get-info.outputs.base-name }}_Windows_x86
191-
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x86.zip
192-
- name: Upload 64-bit artifact
41+
name: ${{ env.ARTIFACT_NAME_DEFAULT_APPIMAGE }}
42+
path: build/${{ env.ARTIFACT_NAME_DEFAULT_APPIMAGE }}
43+
- name: Upload artifact
44+
if: ${{ !github.event.act }} # skip during local actions testing
19345
uses: actions/upload-artifact@v3
19446
with:
195-
name: ${{ needs.get-info.outputs.base-name }}_Windows_x64
196-
path: ${{ env.OUTPUT_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_x64.zip
197-
- name: Prepare for release
198-
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
199-
shell: bash
200-
run: |
201-
mkdir -p ${{ env.RELEASE_FOLDER }}
202-
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
203-
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
47+
name: ${{ env.ARTIFACT_NAME_DROP-IN_APPIMAGE }}
48+
path: build/${{ env.ARTIFACT_NAME_DROP-IN_APPIMAGE }}
20449
- name: Upload release
20550
if: ${{ startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v') }}
20651
uses: ncipollo/release-action@v1
20752
with:
208-
allowUpdates: true
209-
artifacts: |
210-
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x86.zip
211-
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_x64.zip
212-
${{ env.RELEASE_FOLDER }}/${{ steps.process-app-name.outputs.product-name }}_Windows_installer.exe
213-
body: ${{ needs.get-info.outputs.update-note }}
214-
name: ${{ needs.get-info.outputs.update-title }}
53+
artifacts: build/*
21554
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}

release.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ chmod +x 'squashfs-root/bin/BYTEPATH'
6363
rm 'squashfs-root/love.desktop'
6464
cp "${repo_dir}/resources/BYTEPATH.desktop" 'squashfs-root/'
6565

66-
./appimagetool-x86_64.AppImage 'squashfs-root' 'BYTEPATH.AppImage'
66+
if [ "${CI:-'false'}" = 'true' ] ; then
67+
# we're in a container, fuse won't work
68+
./appimagetool-x86_64.AppImage --appimage-extract-and-run 'squashfs-root' 'BYTEPATH.AppImage'
69+
else
70+
./appimagetool-x86_64.AppImage 'squashfs-root' 'BYTEPATH.AppImage'
71+
fi
6772

6873
mv 'BYTEPATH.AppImage' "$repo_dir/build"
6974

0 commit comments

Comments
 (0)