Generate tiles for Mineways #57
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: https://erich.realtimerendering.com/minecraft/public/mineways/mineways.zip | |
MINEWAYS_VERSION: 11.04 | |
# 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: | |
download: | |
name: Download Mineways | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
outputs: | |
cache-key: ${{ steps.cache-keys.outputs.cache-key }} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout repo | |
id: checkout | |
- name: Generate Cache Key | |
id: cache-keys | |
run: Write-Host "::set-output name=cache-key::mineways-${{ env.MINEWAYS_VERSION }}" | |
- uses: actions/cache@v3 | |
name: Get Mineways executables from cache | |
id: cache-mineways | |
with: | |
path: mineways.zip | |
key: ${{ steps.cache-keys.outputs.cache-key }} | |
- name: Download and Cache Dependency | |
if: steps.cache-mineways.outputs.cache-hit != 'true' | |
run: | | |
Invoke-WebRequest -Uri $env:MINEWAYS_URL -OutFile mineways.zip | |
- name: Create required directories | |
id: setup-directories | |
shell: powershell | |
run: | | |
$paths = @($env:TM_PATH, $env:PACK_PATH, $env:TILE_PATH, "${env:GITHUB_WORKSPACE}\dist\mineways", "${env:GITHUB_WORKSPACE}\dist\mineways\blocks") | |
foreach($path in $paths) { | |
$createdPath = [System.IO.Directory]::CreateDirectory($path) | |
if(-not (Test-Path -Path $createdPath)) { | |
Write-Output "::error::Failed to create directory $path" | |
exit 1 | |
} | |
} | |
- name: Extract Mineways | |
id: extract-mineways | |
shell: powershell | |
run: | | |
Expand-Archive -Path mineways.zip -DestinationPath mineways -Force | |
Copy-Item -Path "${env:GITHUB_WORKSPACE}\mineways\*.exe","${env:GITHUB_WORKSPACE}\mineways\terrainBase.png" -Destination $env:TM_PATH -Force | |
Copy-Item -Path "${env:GITHUB_WORKSPACE}\mineways\textures\blocks" -Destination $env:PACK_PATH -Recurse -Force | |
tilemaker: | |
needs: download | |
strategy: | |
matrix: | |
size: [256, 128, 64] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- 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@v3 | |
with: | |
name: terrainExt_${{ env.TERRAIN_NAME }} | |
path: dist/mineways/*.png |