Update .github/workflows/build-and-upload.yml
Some checks failed
CI/CD for Minecraft Resource Pack / build (push) Failing after 14s
Some checks failed
CI/CD for Minecraft Resource Pack / build (push) Failing after 14s
This commit is contained in:
parent
b23ea3b62e
commit
56d8d27a9e
72
.github/workflows/build-and-upload.yml
vendored
72
.github/workflows/build-and-upload.yml
vendored
@ -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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -13,70 +12,23 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
env:
|
|
||||||
PACKSQUASH_REPO: ComunidadAylas/PackSquash
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Step 1: Check out the repository
|
- name: Checkout repository
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Step 2: Set up dependencies (e.g., jq for JSON parsing)
|
- name: Set up Node.js
|
||||||
- name: Install Dependencies
|
uses: actions/setup-node@v3
|
||||||
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:
|
with:
|
||||||
script: |
|
node-version: '16'
|
||||||
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 4: Download the latest PackSquash release
|
- name: Install dependencies
|
||||||
- name: Download PackSquash
|
run: npm install
|
||||||
run: |
|
|
||||||
echo "Downloading PackSquash from ${{ steps.get_release.outputs.result }}"
|
|
||||||
curl -L "${{ steps.get_release.outputs.result }}" -o pack_squash.zip
|
|
||||||
|
|
||||||
# Step 5: Extract PackSquash
|
- name: Zip the resource pack
|
||||||
- name: Extract PackSquash
|
run: zip -r resource-pack.zip ./*
|
||||||
run: unzip pack_squash.zip -d pack_squash
|
|
||||||
|
|
||||||
# Step 6: Ensure PackSquash is executable
|
- name: Upload artifact
|
||||||
- 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
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: optimized-resource-pack
|
name: resource-pack
|
||||||
path: optimized-resource-pack.zip
|
path: resource-pack.zip
|
Loading…
Reference in New Issue
Block a user