This commit is contained in:
AFCMS 2024-05-17 17:20:00 +03:00 committed by GitHub
commit ef35f0f9ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 114 additions and 0 deletions

57
.github/workflows/flatpak.yml vendored Normal file
View File

@ -0,0 +1,57 @@
---
name: flatpak
on:
push:
branches: [ "master" ]
tags: [ "*" ]
pull_request:
workflow_dispatch:
inputs:
use_cache:
description: "Use build cache"
required: true
type: boolean
default: true
permissions:
id-token: write
contents: read
attestations: write
jobs:
build:
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Determine output file name
run: |
add_commit=${{ !startsWith(github.ref, 'refs/tags/') }}
major=$(grep -oP 'VERSION_MAJOR\s+\K\d+' CMakeLists.txt)
minor=$(grep -oP 'VERSION_MINOR\s+\K\d+' CMakeLists.txt)
patch=$(grep -oP 'VERSION_PATCH\s+\K\d+' CMakeLists.txt)
file_name="Minetest-$major.$minor.$patch$([[ "$add_commit" != "false" ]] && echo "-$(echo ${{ github.sha }} | cut -c 1-7)").flatpak"
echo "File name: $file_name"
echo "FILE_NAME=$file_name" >> $GITHUB_ENV
shell: bash
- name: Build Flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@master
with:
arch: x86_64
bundle: ${{ env.FILE_NAME }}
manifest-path: net.minetest.minetest.yaml
cache-key: flatpak-builder-${{ github.sha }}
restore-cache: ${{ (github.event_name == 'workflow_dispatch' && inputs.use_cache) || !startsWith(github.ref, 'refs/tags/') }}
upload-artifact: true
- name: Generate artifact attestation
if: ${{ github.event_name != 'pull_request' }}
uses: actions/attest-build-provenance@v1
with:
subject-path: ${{ env.FILE_NAME }}

1
.gitignore vendored
View File

@ -118,6 +118,7 @@ compile_commands.json
*.vcxproj*
*.sln
.vs/
.flatpak-builder
# Old irrlichtmt. Still ignored to make bisecting easier.
lib/irrlichtmt

View File

@ -0,0 +1,56 @@
---
$schema: "https://raw.githubusercontent.com/flatpak/flatpak-builder/main/data/flatpak-manifest.schema.json"
app-id: net.minetest.minetest
runtime: org.freedesktop.Platform
runtime-version: "23.08"
sdk: org.freedesktop.Sdk
command: minetest
rename-icon: minetest
finish-args:
- "--socket=wayland"
- "--socket=fallback-x11"
- "--socket=pulseaudio"
- "--device=all"
- "--share=ipc"
- "--share=network"
cleanup:
- "/include"
- "/lib/pkgconfig"
- "/share/aclocal"
- "/share/gtk-doc"
- "/share/man"
- "*.la"
- "*.a"
modules:
- name: libluajit
no-autogen: true
make-args:
- PREFIX=/app
make-install-args:
- PREFIX=/app
cleanup:
- "/bin"
sources:
- type: git
url: https://github.com/LuaJIT/LuaJIT.git
commit: dad04f1754723e76ba9dcf9f401f3134a0cd3972
- name: minetest
buildsystem: cmake-ninja
config-opts:
- "-DENABLE_CURSES=0"
- "-DENABLE_GETTEXT=1"
cleanup:
- "/share/minetest/games/devtest"
post-install:
- mv $FLATPAK_DEST/bin/minetest $FLATPAK_DEST/bin/minetest.bin
- install -Dm755 minetest.sh $FLATPAK_DEST/bin/minetest
sources:
- type: dir
path: .
- type: script
dest-filename: minetest.sh
commands:
- 'MINETEST_USER_PATH=$HOME/.var/app/net.minetest.minetest/.minetest exec minetest.bin "$@"'