This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (80 loc) · 2.58 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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: [email protected]
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