Skip to content

Create MCPACK and release #20

Create MCPACK and release

Create MCPACK and release #20

Workflow file for this run

name: Create and Upload .mcpack Archive
on:
workflow_dispatch: # Triggered manually
jobs:
zip_and_upload:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the current repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Create the zip file with .mcpack extension
- name: Create .zip.mcpack file
run: |
zip -r "${GITHUB_REPOSITORY##*/}.zip.mcpack" ./*
# Step 3: Get the latest release ID using GitHub's API
- name: Get latest release ID
id: release_id
run: |
REPO_OWNER="faizul726"
REPO_NAME="oreui-utilities"
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest)
echo "Latest release ID: $(echo $LATEST_RELEASE | jq -r .id)"
echo "::set-output name=release_id::$(echo $LATEST_RELEASE | jq -r .id)"
# Step 4: Upload the .mcpack file to the latest release
- name: Upload .zip.mcpack to release
uses: actions/upload-release-asset@v1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_id: ${{ steps.release_id.outputs.release_id }}
asset_path: "${GITHUB_REPOSITORY##*/}.zip.mcpack"
asset_name: "${GITHUB_REPOSITORY##*/}.zip.mcpack"
asset_content_type: application/zip