48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
name: Build & Publish
|
|
permissions:
|
|
contents: write
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: windows-latest
|
|
defaults:
|
|
run:
|
|
shell: powershell
|
|
|
|
env:
|
|
PROJECT_NAME: Construct
|
|
BP_SOURCE: "packs/BP"
|
|
RP_SOURCE: "packs/RP"
|
|
|
|
steps:
|
|
- uses: https://github.bibk.top/actions/checkout@v4
|
|
|
|
- name: Package mcaddon
|
|
run: |
|
|
$VERSION = $env:GITHUB_REF.Split('/')[-1]
|
|
$OUTPUT = "$($env:PROJECT_NAME)-$VERSION.mcaddon"
|
|
|
|
$BP_DIR = "$($env:PROJECT_NAME)[BP]"
|
|
$RP_DIR = "$($env:PROJECT_NAME)[RP]"
|
|
$BUILD_PATH = Join-Path -Path $PWD -ChildPath "build"
|
|
|
|
New-Item -ItemType Directory -Path $BUILD_PATH -Force | Out-Null
|
|
Copy-Item -Path $env:BP_SOURCE -Destination (Join-Path -Path $BUILD_PATH -ChildPath $BP_DIR) -Recurse
|
|
Copy-Item -Path $env:RP_SOURCE -Destination (Join-Path -Path $BUILD_PATH -ChildPath $RP_DIR) -Recurse
|
|
|
|
Copy-Item -Path "LICENSE" -Destination (Join-Path -Path $BUILD_PATH -ChildPath $BP_DIR)
|
|
Copy-Item -Path "LICENSE" -Destination (Join-Path -Path $BUILD_PATH -ChildPath $RP_DIR)
|
|
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
$ZIP_PATH = Join-Path -Path $PWD -ChildPath $OUTPUT
|
|
if (Test-Path $ZIP_PATH) { Remove-Item $ZIP_PATH }
|
|
[System.IO.Compression.ZipFile]::CreateFromDirectory($BUILD_PATH, $ZIP_PATH)
|
|
|
|
- name: Create Release
|
|
uses: https://github.bibk.top/softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
${{ env.PROJECT_NAME }}-${{ github.event.release.tag_name }}.mcaddon |