forked from cafeberry/cafeberry
142 lines
5.1 KiB
YAML
142 lines
5.1 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version tag for release (e.g. v1.0.0).'
|
|
required: true
|
|
default: ''
|
|
notes:
|
|
description: 'URL to notes for release.'
|
|
required: false
|
|
default: ''
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: windows-2022
|
|
steps:
|
|
- name: Validate version format
|
|
run: |
|
|
if (-not ("${{ inputs.version }}" -match '^v\d+\.\d+\.\d+[a-zA-Z0-9.-]*$')) {
|
|
Write-Error "Version '${{ inputs.version }}' doesn't match expected format (e.g. v1.0.0)"
|
|
exit 1
|
|
}
|
|
|
|
build:
|
|
needs: validate
|
|
strategy:
|
|
matrix:
|
|
configuration: [Release]
|
|
platform: [Windows64, Xbox360, Orbis, PSVita, PS3]
|
|
include:
|
|
- platform: Windows64
|
|
sdk_label: windows-2022 # str1k3r - can run on any runner
|
|
- platform: Xbox360
|
|
sdk_label: sdk-xbox360
|
|
- platform: Orbis
|
|
sdk_label: sdk-orbis
|
|
- platform: PSVita
|
|
sdk_label: sdk-psvita
|
|
- platform: PS3
|
|
sdk_label: sdk-ps3
|
|
|
|
runs-on: [windows-2022, "${{ matrix.sdk_label }}"]
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
clean: false
|
|
lfs: false
|
|
|
|
- name: Build Cafeberry
|
|
run: |
|
|
$platform = if ("${{ matrix.platform }}" -eq "Xbox360") { "Xbox 360" } elseif ("${{ matrix.platform }}" -eq "Orbis") { "ORBIS" } else { "${{ matrix.platform }}" }
|
|
|
|
& "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" MinecraftConsoles.sln `
|
|
/p:Configuration=${{ matrix.configuration }} `
|
|
"/p:Platform=$platform" `
|
|
/m
|
|
|
|
- name: Zip Build
|
|
run: |
|
|
if ("${{ matrix.platform }}" -eq "Windows64") {
|
|
7z a -r "LCEWindows64.zip" "./x64/${{ matrix.configuration }}/*" "-x!*.pdb" "-x!*.pch" "-x!*.ilk"
|
|
} elseif ("${{ matrix.platform }}" -eq "Orbis") {
|
|
7z a -r "LCEOrbis.zip" "./ORBIS_${{ matrix.configuration }}/PS4_GAME/*"
|
|
} elseif ("${{ matrix.platform }}" -eq "PSVita") {
|
|
7z a -r "LCEPSVita.zip" "./PSVita_${{ matrix.configuration }}/PSVITA_GAME/*"
|
|
} elseif ("${{ matrix.platform }}" -eq "PS3") {
|
|
7z a -r "LCEPS3.zip" "./PS3_${{ matrix.configuration }}/*" "-x!*.a" "-x!*.pch" "-x!*.elf" "-x!*.self" "-x!*.map"
|
|
} elseif ("${{ matrix.platform }}" -eq "Xbox360") {
|
|
7z a -r "LCEXbox360.zip" "./X360_${{ matrix.configuration }}/*" "-x!*.pdb" "-x!*.pch" "-x!*.xdb"
|
|
} else {
|
|
7z a -r "LCE${{ matrix.platform }}.zip" "./${{ matrix.platform }}/${{ matrix.configuration }}/*" "-x!*.ipdb" "-x!*.iobj" "-x!*.pdb" "-x!*.pch" "-x!*.ilk"
|
|
}
|
|
|
|
- name: Stage artifacts
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path staging
|
|
Copy-Item "LCE${{ matrix.platform }}.zip" staging/
|
|
|
|
if ("${{ matrix.platform }}" -eq "Windows64") {
|
|
Copy-Item "./x64/${{ matrix.configuration }}/Minecraft.Client.exe" staging/
|
|
} elseif ("${{ matrix.platform }}" -eq "PSVita") {
|
|
Copy-Item "./PSVita_${{ matrix.configuration }}/Minecraft.Client.vpk" staging/LCEPSVita.vpk
|
|
} elseif ("${{ matrix.platform }}" -eq "Orbis") {
|
|
Copy-Item "./ORBIS_${{ matrix.configuration }}/Minecraft.Client.pkg" staging/LCEOrbis.pkg
|
|
}
|
|
|
|
- name: Upload artifacts
|
|
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
|
with:
|
|
name: build-${{ matrix.platform }}
|
|
path: staging/*
|
|
compression-level: 0
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: windows-2022
|
|
steps:
|
|
- name: Download all build artifacts
|
|
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
|
with:
|
|
path: downloaded
|
|
|
|
- name: Fetch release notes
|
|
id: notes
|
|
run: |
|
|
$notesSource = "${{ inputs.notes }}"
|
|
$fallback = "## Cafeberry`n`n### Whoever made this release forgot to put notes, sorry!"
|
|
|
|
if ($notesSource -match '^https?://') {
|
|
try {
|
|
$body = (Invoke-WebRequest -Uri $notesSource -UseBasicParsing).Content
|
|
if ([string]::IsNullOrWhiteSpace($body)) { $body = $fallback }
|
|
} catch {
|
|
$body = $fallback
|
|
}
|
|
} else {
|
|
$body = $fallback
|
|
}
|
|
|
|
$delimiter = "EOF_$([System.Guid]::NewGuid().ToString('N'))"
|
|
$content = "description<<$delimiter`n$body`n$delimiter`n"
|
|
|
|
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
|
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, $content, $utf8NoBom)
|
|
|
|
- name: Publish Release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
name: ${{ inputs.version }}
|
|
server_url: ${{ gitea.server_url }}
|
|
repository: ${{ gitea.repository }}
|
|
token: ${{ gitea.token }}
|
|
tag_name: ${{ inputs.version }}
|
|
prerelease: false
|
|
verbose: true
|
|
files: downloaded/**/*
|
|
body: ${{ steps.notes.outputs.description }} |