Generate tiles for Mineways #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mineways | |
run-name: Generate tiles for Mineways | |
on: | |
workflow_dispatch: | |
env: | |
TERRAIN_NAME: JG-RTX | |
MINEWAYS_URL: http://www.realtimerendering.com/erich/minecraft/public/mineways/files/TileMaker | |
# Path to Mineways executables | |
TM_PATH: bin\mineways\TileMaker | |
# Path to input resource pack | |
PACK_PATH: bedrock\pack\RP | |
# Path to ChannelMixer output / TileMaker input | |
TILE_PATH: dist\mineways\blocks | |
jobs: | |
tilemaker: | |
strategy: | |
matrix: | |
size: [256, 128, 64] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout repo | |
id: checkout | |
- name: Create required directories | |
id: setup-directories | |
shell: powershell | |
run: | | |
[System.IO.Directory]::CreateDirectory($env:TILE_PATH) | |
- name: Copy Mineways textures | |
id: mineways-textures | |
shell: powershell | |
run: | | |
Copy-Item -Path "${env:GITHUB_WORKSPACE}\mineways\textures\blocks" -Destination $env:PACK_PATH -Recurse | |
- uses: actions/cache@v3 | |
name: Get Mineways executables from cache | |
id: cache-mineways | |
with: | |
path: | | |
${{ env.TM_PATH }}\ChannelMixer.exe | |
${{ env.TM_PATH }}\TileMaker.exe | |
${{ env.TM_PATH }}\textures\water_normal.png | |
${{ env.TM_PATH }}\terrainBase.png | |
key: mineways-tilemaker | |
restore-keys: mineways- | |
- name: Download Mineways executables | |
id: download-mineways | |
if: steps.cache-mineways.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
$files = @('ChannelMixer.exe','TileMaker.exe','terrainBase.png','textures/water_normal.png') | |
$dest = ".\${env:TM_PATH}" | |
[System.IO.Directory]::CreateDirectory("$dest\textures") | |
For ($i = 0; $i -lt $files.Length; $i++) { | |
$file = $files[$i] | |
$fileUrl = "${env:MINEWAYS_URL}/$file" | |
Invoke-WebRequest -Uri ${fileUrl} -OutFile "$dest\\$file" | |
} | |
- name: ChannelMixer | |
id: channelmixer | |
run: | | |
Write-Output "::group::ChannelMixer Log" | |
& "${env:TM_PATH}\ChannelMixer.exe" -v -m -i $env:PACK_PATH -o $env:TILE_PATH | |
Write-Output "::endgroup::" | |
- name: TileMaker @ ${{ matrix.size }} | |
id: tilemaker | |
run: | | |
$size = ${{ matrix.size }}; | |
Write-Output "::group::TileMaker Log ($size)" | |
& "${env:TM_PATH}\TileMaker.exe" -v -m -i "${env:TM_PATH}\terrainBase.png" -d $env:TILE_PATH -o "${env:GITHUB_WORKSPACE}\dist\mineways\terrainExt_${env:TERRAIN_NAME}$size.png" -t $size | |
Write-Output "::endgroup::" | |
- name: Upload terrain texture | |
id: upload-terrain | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: terrainExt_${{ env.TERRAIN_NAME }} | |
path: dist/mineways/*.png |