From d9b0c48a94f315f780f328a0838e65a3ee958585 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Sun, 20 Oct 2024 19:59:43 +0200 Subject: [PATCH 01/13] Add .github/workflows/main.yml --- .github/workflows/main.yml | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..08c3c59 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: Resourcepack Zipper + +on: + push: + branches: + - master # Adjust this branch name if needed + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 # A non-shallow repository clone is required + + - name: Run PackSquash + uses: ComunidadAylas/PackSquash-action@v4 + with: + packsquash_version: latest # Uses the latest PackSquash release supported by the action + shader_source_transformation_strategy: keep_as_is + + - name: Create ZIP file + run: | + COMMIT_ID=$(git rev-parse --short HEAD) + ZIP_NAME="RP.zip" + echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV + zip -r "${ZIP_NAME}" . + + - name: Upload ZIP artifact + uses: actions/upload-artifact@v2 + with: + name: resource-pack-artifact + path: ${{ env.ZIP_NAME }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.RESOURCE_ZIPPER }} + with: + tag_name: release-${{ github.sha }} + release_name: Release ${{ github.sha }} + draft: false + prerelease: false + + - name: Upload Release Artifact + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.RESOURCE_ZIPPER }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/${{ env.ZIP_NAME }} + asset_name: ${{ env.ZIP_NAME }} + asset_content_type: application/zip \ No newline at end of file From 73b069c8c8b2886251a1555991a9d092ab0f20b8 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Sun, 20 Oct 2024 20:00:29 +0200 Subject: [PATCH 02/13] Change name of branch from master to main --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 08c3c59..b8013c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Resourcepack Zipper on: push: branches: - - master # Adjust this branch name if needed + - main jobs: build: From 5a50151d17604918aec662c0083211e56bc9159a Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Sun, 20 Oct 2024 20:10:10 +0200 Subject: [PATCH 03/13] Delete assets/minecraft/textures/item/custom/cui/stick/texture_0.png --- assets/minecraft/textures/item/custom/cui/stick/texture_0.png | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 assets/minecraft/textures/item/custom/cui/stick/texture_0.png diff --git a/assets/minecraft/textures/item/custom/cui/stick/texture_0.png b/assets/minecraft/textures/item/custom/cui/stick/texture_0.png deleted file mode 100644 index e69de29..0000000 From d02c72749ab9cc2b3fef26a6c23332cf9674b0ac Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Sun, 20 Oct 2024 20:10:25 +0200 Subject: [PATCH 04/13] Delete assets/minecraft/textures/item/custom/cui/cobblestone/texture_0.png --- .../minecraft/textures/item/custom/cui/cobblestone/texture_0.png | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 assets/minecraft/textures/item/custom/cui/cobblestone/texture_0.png diff --git a/assets/minecraft/textures/item/custom/cui/cobblestone/texture_0.png b/assets/minecraft/textures/item/custom/cui/cobblestone/texture_0.png deleted file mode 100644 index e69de29..0000000 From a72fcca54b5561edbc923937d8677ed6560607d2 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Sun, 20 Oct 2024 20:45:42 +0200 Subject: [PATCH 05/13] Update .gitea/workflows/main.yml --- {.github => .gitea}/workflows/main.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {.github => .gitea}/workflows/main.yml (100%) diff --git a/.github/workflows/main.yml b/.gitea/workflows/main.yml similarity index 100% rename from .github/workflows/main.yml rename to .gitea/workflows/main.yml From b9fafcb2fa63bd9b3a303ac550a3a8a105408e47 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:26:15 +0200 Subject: [PATCH 06/13] New builder Added a new builder, not using someone else's. --- .gitea/workflows/main.yml | 57 -------------------------- .github/workflows/build-and-upload.yml | 45 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 57 deletions(-) delete mode 100644 .gitea/workflows/main.yml create mode 100644 .github/workflows/build-and-upload.yml diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml deleted file mode 100644 index b8013c9..0000000 --- a/.gitea/workflows/main.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Resourcepack Zipper - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # A non-shallow repository clone is required - - - name: Run PackSquash - uses: ComunidadAylas/PackSquash-action@v4 - with: - packsquash_version: latest # Uses the latest PackSquash release supported by the action - shader_source_transformation_strategy: keep_as_is - - - name: Create ZIP file - run: | - COMMIT_ID=$(git rev-parse --short HEAD) - ZIP_NAME="RP.zip" - echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV - zip -r "${ZIP_NAME}" . - - - name: Upload ZIP artifact - uses: actions/upload-artifact@v2 - with: - name: resource-pack-artifact - path: ${{ env.ZIP_NAME }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.RESOURCE_ZIPPER }} - with: - tag_name: release-${{ github.sha }} - release_name: Release ${{ github.sha }} - draft: false - prerelease: false - - - name: Upload Release Artifact - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.RESOURCE_ZIPPER }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/${{ env.ZIP_NAME }} - asset_name: ${{ env.ZIP_NAME }} - asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml new file mode 100644 index 0000000..85ff266 --- /dev/null +++ b/.github/workflows/build-and-upload.yml @@ -0,0 +1,45 @@ +name: Build and Upload Optimized Resource Pack + +# Trigger the workflow on push to the main branch or on pull requests +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - name: Checkout Repository + uses: actions/checkout@v3 + + # Step 2: Set up Node.js environment using the latest LTS version + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' # Dynamically uses the latest LTS version + + # Step 3: Install PackSquash globally + - name: Install PackSquash + run: npm install -g packsquash + + # Step 4: Optimize the resource pack using PackSquash + - name: Optimize Resource Pack + run: packsquash optimize ./path-to-your-resource-pack ./optimized-resource-pack + + # Step 5: Zip the optimized resource pack + - name: Zip Optimized Pack + run: | + zip -r optimized-resource-pack.zip ./optimized-resource-pack + + # Step 6: Upload the zipped artifact + - name: Upload Optimized Pack Artifact + uses: actions/upload-artifact@v3 + with: + name: optimized-resource-pack + path: optimized-resource-pack.zip \ No newline at end of file From b23ea3b62e2ee235d325f6b96a4e17b557085f3d Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:31:22 +0200 Subject: [PATCH 07/13] Update .github/workflows/build-and-upload.yml --- .github/workflows/build-and-upload.yml | 59 +++++++++++++++++++++----- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 85ff266..6d30c8d 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -13,31 +13,68 @@ jobs: build: runs-on: ubuntu-latest + env: + PACKSQUASH_REPO: ComunidadAylas/PackSquash + steps: # Step 1: Check out the repository - name: Checkout Repository uses: actions/checkout@v3 - # Step 2: Set up Node.js environment using the latest LTS version - - name: Setup Node.js - uses: actions/setup-node@v3 + # Step 2: Set up dependencies (e.g., jq for JSON parsing) + - name: Install Dependencies + run: sudo apt-get update && sudo apt-get install -y jq unzip + + # Step 3: Fetch the latest PackSquash release information + - name: Get Latest PackSquash Release + id: get_release + uses: actions/github-script@v6 with: - node-version: 'lts/*' # Dynamically uses the latest LTS version + script: | + const repo = process.env.PACKSQUASH_REPO; + const response = await github.rest.repos.getLatestRelease({ + owner: repo.split('/')[0], + repo: repo.split('/')[1], + }); + const assets = response.data.assets; + // Determine the OS and architecture + let assetName = ''; + if (process.platform === 'linux') { + assetName = assets.find(asset => asset.name.includes('linux') && asset.name.endsWith('.zip')).browser_download_url; + } else if (process.platform === 'win32') { + assetName = assets.find(asset => asset.name.includes('windows') && asset.name.endsWith('.zip')).browser_download_url; + } else if (process.platform === 'darwin') { + assetName = assets.find(asset => asset.name.includes('macos') && asset.name.endsWith('.zip')).browser_download_url; + } else { + throw new Error('Unsupported OS'); + } + return assetName; - # Step 3: Install PackSquash globally - - name: Install PackSquash - run: npm install -g packsquash + # Step 4: Download the latest PackSquash release + - name: Download PackSquash + run: | + echo "Downloading PackSquash from ${{ steps.get_release.outputs.result }}" + curl -L "${{ steps.get_release.outputs.result }}" -o pack_squash.zip - # Step 4: Optimize the resource pack using PackSquash + # Step 5: Extract PackSquash + - name: Extract PackSquash + run: unzip pack_squash.zip -d pack_squash + + # Step 6: Ensure PackSquash is executable + - name: Make PackSquash Executable + run: chmod +x ./pack_squash/pack_squash + + # Step 7: Optimize the resource pack using PackSquash - name: Optimize Resource Pack - run: packsquash optimize ./path-to-your-resource-pack ./optimized-resource-pack + run: | + ./pack_squash/pack_squash optimize ./path-to-your-resource-pack ./optimized-resource-pack - # Step 5: Zip the optimized resource pack + # Step 8: Zip the optimized resource pack - name: Zip Optimized Pack run: | zip -r optimized-resource-pack.zip ./optimized-resource-pack - # Step 6: Upload the zipped artifact + # Step 9: Upload the zipped artifact - name: Upload Optimized Pack Artifact uses: actions/upload-artifact@v3 with: From 56d8d27a9e3a14a28a7a4549571eeba27f9dc125 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:36:05 +0200 Subject: [PATCH 08/13] Update .github/workflows/build-and-upload.yml --- .github/workflows/build-and-upload.yml | 72 +++++--------------------- 1 file changed, 12 insertions(+), 60 deletions(-) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 6d30c8d..2196b9e 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -1,6 +1,5 @@ -name: Build and Upload Optimized Resource Pack +name: CI/CD for Minecraft Resource Pack -# Trigger the workflow on push to the main branch or on pull requests on: push: branches: @@ -13,70 +12,23 @@ jobs: build: runs-on: ubuntu-latest - env: - PACKSQUASH_REPO: ComunidadAylas/PackSquash - steps: - # Step 1: Check out the repository - - name: Checkout Repository + - name: Checkout repository uses: actions/checkout@v3 - # Step 2: Set up dependencies (e.g., jq for JSON parsing) - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install -y jq unzip - - # Step 3: Fetch the latest PackSquash release information - - name: Get Latest PackSquash Release - id: get_release - uses: actions/github-script@v6 + - name: Set up Node.js + uses: actions/setup-node@v3 with: - script: | - const repo = process.env.PACKSQUASH_REPO; - const response = await github.rest.repos.getLatestRelease({ - owner: repo.split('/')[0], - repo: repo.split('/')[1], - }); - const assets = response.data.assets; - // Determine the OS and architecture - let assetName = ''; - if (process.platform === 'linux') { - assetName = assets.find(asset => asset.name.includes('linux') && asset.name.endsWith('.zip')).browser_download_url; - } else if (process.platform === 'win32') { - assetName = assets.find(asset => asset.name.includes('windows') && asset.name.endsWith('.zip')).browser_download_url; - } else if (process.platform === 'darwin') { - assetName = assets.find(asset => asset.name.includes('macos') && asset.name.endsWith('.zip')).browser_download_url; - } else { - throw new Error('Unsupported OS'); - } - return assetName; + node-version: '16' - # Step 4: Download the latest PackSquash release - - name: Download PackSquash - run: | - echo "Downloading PackSquash from ${{ steps.get_release.outputs.result }}" - curl -L "${{ steps.get_release.outputs.result }}" -o pack_squash.zip + - name: Install dependencies + run: npm install - # Step 5: Extract PackSquash - - name: Extract PackSquash - run: unzip pack_squash.zip -d pack_squash + - name: Zip the resource pack + run: zip -r resource-pack.zip ./* - # Step 6: Ensure PackSquash is executable - - name: Make PackSquash Executable - run: chmod +x ./pack_squash/pack_squash - - # Step 7: Optimize the resource pack using PackSquash - - name: Optimize Resource Pack - run: | - ./pack_squash/pack_squash optimize ./path-to-your-resource-pack ./optimized-resource-pack - - # Step 8: Zip the optimized resource pack - - name: Zip Optimized Pack - run: | - zip -r optimized-resource-pack.zip ./optimized-resource-pack - - # Step 9: Upload the zipped artifact - - name: Upload Optimized Pack Artifact + - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: optimized-resource-pack - path: optimized-resource-pack.zip \ No newline at end of file + name: resource-pack + path: resource-pack.zip \ No newline at end of file From f602e188cf05e9f515649150c9e260f5c9bd3af9 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:38:17 +0200 Subject: [PATCH 09/13] Update .github/workflows/build-and-upload.yml --- .github/workflows/build-and-upload.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 2196b9e..bc82907 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -16,14 +16,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Install dependencies - run: npm install - - name: Zip the resource pack run: zip -r resource-pack.zip ./* From cb67fb4dccf56bcfd97ebfc0c289406937600e26 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:41:10 +0200 Subject: [PATCH 10/13] Added PackSquash --- .github/workflows/build-and-upload.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index bc82907..9dcd76d 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -16,6 +16,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Run PackSquash + uses: ComunidadAylas/PackSquash-action@v4 + with: + packsquash_version: latest + - name: Zip the resource pack run: zip -r resource-pack.zip ./* From d020dd3e01f79a7eb6bed35b45615e6740a8a6e9 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:44:43 +0200 Subject: [PATCH 11/13] Update .github/workflows/build-and-upload.yml --- .github/workflows/build-and-upload.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 9dcd76d..fb6f251 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Run PackSquash uses: ComunidadAylas/PackSquash-action@v4 From 00512dd1fba1ad32a9491e8b8cd7ca5cde7b7562 Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 18:56:39 +0200 Subject: [PATCH 12/13] Update .github/workflows/packsquash.yml --- .github/workflows/build-and-upload.yml | 33 -------------------------- .github/workflows/packsquash.yml | 33 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/build-and-upload.yml create mode 100644 .github/workflows/packsquash.yml diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml deleted file mode 100644 index fb6f251..0000000 --- a/.github/workflows/build-and-upload.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: CI/CD for Minecraft Resource Pack - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Run PackSquash - uses: ComunidadAylas/PackSquash-action@v4 - with: - packsquash_version: latest - - - name: Zip the resource pack - run: zip -r resource-pack.zip ./* - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: resource-pack - path: resource-pack.zip \ No newline at end of file diff --git a/.github/workflows/packsquash.yml b/.github/workflows/packsquash.yml new file mode 100644 index 0000000..1545ef9 --- /dev/null +++ b/.github/workflows/packsquash.yml @@ -0,0 +1,33 @@ +name: Optimize resource pack +on: [push] +# This permissions section explicitly gives the workflow permission to create releases. +# Most of the time it's not needed to set it, as the default GITHUB_TOKEN permissions +# are permissive enough, but that's not always the case +permissions: + contents: write +jobs: + packsquash: + name: Optimize resource pack + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # A non-shallow repository clone is required + - name: Run PackSquash + uses: ComunidadAylas/PackSquash-action@v4 + with: + packsquash_version: latest + options: | + # Optimize the pack in the root repository directory. + # This is the default value for pack_directory when no PackSquash options are defined + pack_directory = '.' + + # Set a custom output file path to work with the generated ZIP file + # without needing to download its artifact in a separate step + output_file_path = '/tmp/pack.zip' + - name: Tag and create release + uses: softprops/action-gh-release@v2 + with: + tag_name: action-v${{ github.run_number }} + files: /tmp/pack.zip \ No newline at end of file From aecc1a82fd43a74191fed53c6f691e0552599c0b Mon Sep 17 00:00:00 2001 From: Lexian-droid Date: Tue, 22 Oct 2024 19:14:15 +0200 Subject: [PATCH 13/13] Changed the doohickey to only happen on tag push --- .github/workflows/packsquash.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/packsquash.yml b/.github/workflows/packsquash.yml index 1545ef9..2f3accf 100644 --- a/.github/workflows/packsquash.yml +++ b/.github/workflows/packsquash.yml @@ -1,10 +1,8 @@ name: Optimize resource pack -on: [push] -# This permissions section explicitly gives the workflow permission to create releases. -# Most of the time it's not needed to set it, as the default GITHUB_TOKEN permissions -# are permissive enough, but that's not always the case -permissions: - contents: write +on: + push: + tags: + - '**' jobs: packsquash: name: Optimize resource pack @@ -19,15 +17,9 @@ jobs: with: packsquash_version: latest options: | - # Optimize the pack in the root repository directory. - # This is the default value for pack_directory when no PackSquash options are defined pack_directory = '.' - - # Set a custom output file path to work with the generated ZIP file - # without needing to download its artifact in a separate step output_file_path = '/tmp/pack.zip' - - name: Tag and create release + - name: Create release uses: softprops/action-gh-release@v2 with: - tag_name: action-v${{ github.run_number }} files: /tmp/pack.zip \ No newline at end of file