Merge branch 'main' of https://git.owlcode.tech/NataliaTheDrowned2/mcaddon-package-workflow.git into main
This commit is contained in:
commit
7862c9d189
|
@ -1,81 +0,0 @@
|
|||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
commit_changes:
|
||||
description: Whether the built artifacts should be uploaded to `inputs.target_path`
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
pack_name:
|
||||
description: The name of the file
|
||||
required: true
|
||||
type: string
|
||||
pack_type:
|
||||
description: What kind of package you are building
|
||||
required: true
|
||||
type: number
|
||||
bp_path:
|
||||
description: Path to the behavior pack
|
||||
required: false
|
||||
type: string
|
||||
default: ./bp
|
||||
rp_path:
|
||||
description: Path to the resource pack
|
||||
required: false
|
||||
type: string
|
||||
default: ./rp
|
||||
target_path:
|
||||
description: Where you would like the assets to be stored
|
||||
required: false
|
||||
type: string
|
||||
default: ./assets
|
||||
user_name:
|
||||
description: User name to be used in commit push IF commit_changes is true
|
||||
required: false
|
||||
type: string
|
||||
default: github-actions
|
||||
user_email:
|
||||
description: User email to be used in commit push IF commit_changes is true
|
||||
required: false
|
||||
type: string
|
||||
default: github-actions@github.com
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Get adm-zip
|
||||
run: npm install adm-zip --save-dev
|
||||
- name: Package Assets
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
var AZ = require("adm-zip");
|
||||
var handle = require("./build-handler.js");
|
||||
var pType = ${{ inputs.pack_type }};
|
||||
var builds = {};
|
||||
|
||||
if (pType === 0 || pType === 1) {
|
||||
var bp = new AZ();
|
||||
bp.addLocalFolder("${{ inputs.bp_path }}");
|
||||
// bp.writeZip("${{ inputs.target_path }}/${{ inputs.pack_name }}_bp.mcpack")
|
||||
builds.bp = bp;
|
||||
}
|
||||
if (pType === 0 || 2) {
|
||||
var rp = new AZ();
|
||||
rp.addLocalFolder("${{ inputs.rp_path }}");
|
||||
rp.writeZip("${{ inputs.target_path }}/${{ inputs.pack_name }}_rp.mcpack")
|
||||
}
|
||||
if (pType === 0) {
|
||||
var add = new AZ();
|
||||
add.addLocalFolder("${{ inputs.target_path }}")
|
||||
add.writeZip("${{ inputs.target_path }}")
|
||||
}
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git pull
|
||||
git config user.name ${{ inputs.user_name }}
|
||||
git config user.email ${{ inputs.user_email }}
|
||||
git add .
|
||||
git commit -m "generate \`${{inputs.versionString}}\` assets"
|
||||
git push
|
Loading…
Reference in New Issue