diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index faf2955..ad472ee 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -2,6 +2,15 @@ name: Create Release on: workflow_dispatch: + inputs: + bump: + description: "Version part to increment for this release" + type: choice + default: patch + options: + - patch + - minor + - major jobs: build-and-publish: @@ -23,17 +32,40 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Bump version + - name: Determine next version id: version - uses: vemel/nextversion@0.1.1 - with: - path: ./addon_starter/complete/package.json - type: semver - result: ${{ github.event.inputs.bump }} - release: ${{ github.event.inputs.release }} - update: | - ./addon_starter/complete/package.json - ./addon_starter/complete/README.md + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + BUMP="${{ github.event.inputs.bump }}" + BUMP="${BUMP:-patch}" + + # Highest MAJOR.MINOR.PATCH across all existing releases, including + # drafts and prereleases (which the /releases/latest endpoint skips). + LATEST=$(gh api --paginate "repos/${{ github.repository }}/releases" \ + --jq '.[].tag_name' \ + | sed -E 's/^v//; s/-.*$//' \ + | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \ + | sort -t. -k1,1n -k2,2n -k3,3n \ + | tail -n1 || true) + + if [ -z "$LATEST" ]; then + # No releases yet: bootstrap from package.json, used as-is. + NEXT=$(node -p "require('./addon_starter/complete/package.json').version") + echo "No prior releases found; bootstrapping to $NEXT" + else + IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST" + case "$BUMP" in + major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;; + minor) MINOR=$((MINOR + 1)); PATCH=0 ;; + *) PATCH=$((PATCH + 1)) ;; + esac + NEXT="$MAJOR.$MINOR.$PATCH" + echo "Latest released version $LATEST -> next $NEXT ($BUMP)" + fi + + echo "version=$NEXT" >> "$GITHUB_OUTPUT" - name: Build env: @@ -56,19 +88,13 @@ jobs: npm run mcaddon popd - - name: Get Package Version - id: get-package-version - with: - path: addon_starter/complete/ - uses: stevenbenitez/get-package-version-action@v1 - - name: Create draft Minecraft Samples release id: create_samples_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: v${{ steps.get-package-version.outputs.version }}-alpha + tag_name: v${{ steps.version.outputs.version }}-alpha release_name: Minecraft Samples draft: true prerelease: true @@ -81,7 +107,7 @@ jobs: with: upload_url: ${{ steps.create_samples_release.outputs.upload_url }} asset_path: ./addon_starter/complete/dist/packages/aop_mobs.mcaddon - asset_name: addon_starter_complete_v${{ steps.get-package-version.outputs.version }}.mcaddon + asset_name: addon_starter_complete_v${{ steps.version.outputs.version }}.mcaddon asset_content_type: application/zip - name: Upload chill_dreams_complete_v.mcaddon to node_module release @@ -92,7 +118,7 @@ jobs: with: upload_url: ${{ steps.create_samples_release.outputs.upload_url }} asset_path: ./casual_creator/chill_dreams/complete/dist/packages/mamm_cds.mcaddon - asset_name: chill_dreams_complete_v${{ steps.get-package-version.outputs.version }}.mcaddon + asset_name: chill_dreams_complete_v${{ steps.version.outputs.version }}.mcaddon asset_content_type: application/zip - name: Upload gray_wave_v.mcaddon to node_module release @@ -103,7 +129,7 @@ jobs: with: upload_url: ${{ steps.create_samples_release.outputs.upload_url }} asset_path: ./casual_creator/gray_wave/dist/packages/mikeamm_gwve.mcaddon - asset_name: gray_wave_v${{ steps.get-package-version.outputs.version }}.mcaddon + asset_name: gray_wave_v${{ steps.version.outputs.version }}.mcaddon asset_content_type: application/zip - name: Upload toss_lab_v.mcaddon to node_module release @@ -114,14 +140,5 @@ jobs: with: upload_url: ${{ steps.create_samples_release.outputs.upload_url }} asset_path: ./toss_lab/dist/packages/toss_lab.mcaddon - asset_name: toss_lab_v${{ steps.get-package-version.outputs.version }}.mcaddon + asset_name: toss_lab_v${{ steps.version.outputs.version }}.mcaddon asset_content_type: application/zip - - - name: Commit version changes - run: | - VERSION=${{ toJSON(steps.version.outputs.result) }} - BRANCH="main" - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -am "Bump version to $VERSION" - git push origin $BRANCH diff --git a/multi-block_sample/behavior_pack/blocks/horizontal_log.json b/multi-block_sample/behavior_pack/blocks/horizontal_log.json new file mode 100644 index 0000000..fae4836 --- /dev/null +++ b/multi-block_sample/behavior_pack/blocks/horizontal_log.json @@ -0,0 +1,74 @@ +{ + "format_version": "1.26.40", + "minecraft:block": { + "description": { + "identifier": "multi_block:horizontal_log", + "traits": { + "minecraft:placement_direction": { + "enabled_states": [ + "minecraft:cardinal_direction" + ] + }, + "minecraft:multi_block": { + "enabled_states": ["minecraft:multi_block_part"], + "parts": 4, + "direction": "north" + } + } + }, + + "components": { + "minecraft:geometry": "minecraft:geometry.full_block", + "minecraft:material_instances": { + "up": {"texture": "horizontal_log_side"}, + "down": {"texture": "horizontal_log_side"}, + "north": {"texture": "horizontal_log_top"}, + "south": {"texture": "horizontal_log_top"}, + "west": {"texture": "horizontal_log_side"}, + "east": {"texture": "horizontal_log_side"} + }, + "minecraft:collision_box": true, + "minecraft:movable": {"movement_type": "immovable"}, + "minecraft:destructible_by_mining": { + "seconds_to_destroy": 3 + }, + "minecraft:destructible_by_explosion": { + "explosion_resistance": 3 + } + }, + "permutations": [ + { + "condition": "q.block_state('minecraft:cardinal_direction') == 'north'", + "components": { + "minecraft:transformation": { + "rotation": [0,0,0] + } + } + }, + { + "condition": "q.block_state('minecraft:cardinal_direction') == 'south'", + "components": { + "minecraft:transformation": { + "rotation": [0,180,0] + } + } + }, + { + "condition": "q.block_state('minecraft:cardinal_direction') == 'west'", + "components": { + "minecraft:transformation": { + "rotation": [0,90,0] + } + } + }, + { + "condition": "q.block_state('minecraft:cardinal_direction') == 'east'", + "components": { + "minecraft:transformation": { + "rotation": [0,270,0] + } + } + } + ] + } +} \ No newline at end of file diff --git a/multi-block_sample/behavior_pack/items/horizontal_log_item.json b/multi-block_sample/behavior_pack/items/horizontal_log_item.json new file mode 100644 index 0000000..5ef6daa --- /dev/null +++ b/multi-block_sample/behavior_pack/items/horizontal_log_item.json @@ -0,0 +1,27 @@ +{ + "format_version": "1.21.100", + "minecraft:item": { + "description": { + "identifier": "multi_block:horizontal_log" + }, + + "components": { + "minecraft:icon": { + "textures": { + "default": "horizontal_log_item" + } + }, + "minecraft:block_placer": { + "block": "multi_block:horizontal_log", + "replace_block_item": true + }, + "minecraft:display_name": { + "value": "horizontal log" + }, + "minecraft:tags": { + "tags": [ "minecraft:logs_that_burn" ] + }, + "minecraft:max_stack_size": 64 + } + } +} diff --git a/multi-block_sample/resource_pack/blocks.json b/multi-block_sample/resource_pack/blocks.json index dcf4ca0..8c9943c 100644 --- a/multi-block_sample/resource_pack/blocks.json +++ b/multi-block_sample/resource_pack/blocks.json @@ -6,5 +6,8 @@ ], "multiblock:light": { "sound": "metal" + }, + "multi_block:horizontal_log": { + "sound": "wood" } } \ No newline at end of file diff --git a/multi-block_sample/resource_pack/textures/item_texture.json b/multi-block_sample/resource_pack/textures/item_texture.json index bea4b34..7aa8687 100644 --- a/multi-block_sample/resource_pack/textures/item_texture.json +++ b/multi-block_sample/resource_pack/textures/item_texture.json @@ -4,6 +4,9 @@ "texture_data": { "light_post_item": { "textures": "textures/items/light_post_item" - } + }, + "horizontal_log_item": { + "textures": "textures/items/horizontal_log" + } } } \ No newline at end of file diff --git a/multi-block_sample/resource_pack/textures/items/horizontal_log.png b/multi-block_sample/resource_pack/textures/items/horizontal_log.png new file mode 100644 index 0000000..3c8549a Binary files /dev/null and b/multi-block_sample/resource_pack/textures/items/horizontal_log.png differ diff --git a/multi-block_sample/resource_pack/textures/terrain_texture.json b/multi-block_sample/resource_pack/textures/terrain_texture.json index 1a68d5b..d64e360 100644 --- a/multi-block_sample/resource_pack/textures/terrain_texture.json +++ b/multi-block_sample/resource_pack/textures/terrain_texture.json @@ -9,6 +9,12 @@ }, "light_post_off": { "textures": "textures/blocks/light_post_off" + }, + "horizontal_log_top": { + "textures": "textures/blocks/log_birch_top" + }, + "horizontal_log_side": { + "textures": "textures/blocks/log_birch" } } } \ No newline at end of file