mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
ADD: github actions
This commit is contained in:
31
.github/actions/setup-cache/action.yml
vendored
Normal file
31
.github/actions/setup-cache/action.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Setup cache
|
||||||
|
description: Sets up sccache, CPM cache, etc.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
host:
|
||||||
|
description: 'Host platform: win or linux'
|
||||||
|
required: true
|
||||||
|
target:
|
||||||
|
description: 'Target platform: win, linux'
|
||||||
|
required: true
|
||||||
|
use-ccache:
|
||||||
|
description: 'Whether to use ccache/sccache'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Setup sccache
|
||||||
|
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||||
|
with:
|
||||||
|
variant: sccache
|
||||||
|
key: ${{ inputs.target }}-v1
|
||||||
|
if: inputs.use-ccache
|
||||||
|
|
||||||
|
- name: Setup CPM Cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: cpm-cache
|
||||||
|
key: cpm-${{ inputs.target }}-v1-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
|
||||||
|
restore-keys: |
|
||||||
|
cpm-${{ inputs.target }}-v1-
|
||||||
149
.github/workflows/build.yml
vendored
Normal file
149
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
name: Build Game
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
use-ccache:
|
||||||
|
description: 'Enable sccache'
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-windows:
|
||||||
|
name: Windows Build
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup caches
|
||||||
|
uses: ./.github/actions/setup-cache
|
||||||
|
with:
|
||||||
|
host: win
|
||||||
|
target: win
|
||||||
|
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||||
|
|
||||||
|
- name: Create Build Environment
|
||||||
|
# Some projects don't allow in-source building, so create a separate build directory
|
||||||
|
# We'll use this as our working directory for all subsequent commands
|
||||||
|
run: cmake -E make_directory ${{github.workspace}}/build
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
shell: powershell
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
run: cmake $env:GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$env:BUILD_TYPE
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
shell: powershell
|
||||||
|
run: cmake --build . --config $env:BUILD_TYPE --target MinecraftPE
|
||||||
|
|
||||||
|
- name: Upload Binary
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mcpe-windows
|
||||||
|
path: |
|
||||||
|
'MinecraftPE.exe'
|
||||||
|
'glfw3.dll'
|
||||||
|
'libpng16.dll'
|
||||||
|
'OpenAL32.dll'
|
||||||
|
'z.dll'
|
||||||
|
|
||||||
|
build-linux:
|
||||||
|
name: Linux Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup caches
|
||||||
|
uses: ./.github/actions/setup-cache
|
||||||
|
with:
|
||||||
|
host: linux
|
||||||
|
target: linux
|
||||||
|
use-ccache: ${{ github.event_name != 'workflow_dispatch' || inputs.use-ccache }}
|
||||||
|
|
||||||
|
- name: Create Build Environment
|
||||||
|
# Some projects don't allow in-source building, so create a separate build directory
|
||||||
|
# We'll use this as our working directory for all subsequent commands
|
||||||
|
run: cmake -E make_directory ${{github.workspace}}/build
|
||||||
|
|
||||||
|
- name: Setup Environment
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install gcc-multilib
|
||||||
|
sudo apt-get install -y --no-install-recommends build-essential libgl-dev libwayland-dev xorg-dev libxkbcommon-dev
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
# Use a bash shell so we can use the same syntax for environment variable
|
||||||
|
# access regardless of the host operating system
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build . --config $BUILD_TYPE
|
||||||
|
|
||||||
|
- name: Upload Binary
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mcpe-linux
|
||||||
|
path: |
|
||||||
|
'MinecraftPE'
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ build-windows, build-linux ]
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Declare Version Variables
|
||||||
|
id: ref
|
||||||
|
run: |
|
||||||
|
echo "version=$(cat VERSION | xargs)" >> $GITHUB_OUTPUT
|
||||||
|
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Zip Windows Artifacts
|
||||||
|
uses: vimtor/action-zip@v1.2
|
||||||
|
with:
|
||||||
|
files: data mcpe-windows/MinecraftPE.exe mcpe-windows/glfw3.dll mcpe-windows/libpng16.dll mcpe-windows/OpenAL32.dll mcpe-windows/z.dll
|
||||||
|
dest: minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
||||||
|
|
||||||
|
- name: Zip Linux Artifacts
|
||||||
|
uses: vimtor/action-zip@v1.2
|
||||||
|
with:
|
||||||
|
files: data mcpe-linux/MinecraftPE # ye, you should install libraries by urself :trollface:
|
||||||
|
dest: minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
||||||
|
|
||||||
|
- name: Zip Linux Server Artifacts
|
||||||
|
uses: vimtor/action-zip@v1.2
|
||||||
|
with:
|
||||||
|
files: mcpe-linux/MinecraftPE-server
|
||||||
|
dest: minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
|
|
||||||
|
- name: Update Development Release
|
||||||
|
uses: andelf/nightly-release@main
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: dev
|
||||||
|
name: 'Development Release'
|
||||||
|
body: |
|
||||||
|
MinecraftPE development release for commit ${{ github.sha }}.
|
||||||
|
files: |
|
||||||
|
./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
||||||
|
./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
||||||
|
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
Reference in New Issue
Block a user