Build and Package #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install dependencies and run build script | |
run: | | |
echo "👨💻 Installing NPM Packages" | |
npm install | |
echo "👨💻 Building the Code" | |
npm run build | |
echo "✨ Done!" | |
- name: Create ZIP file | |
run: | | |
echo "📚 Creating ZIP file (excluding node_modules and other ZIP files)" | |
zip -r CCBG_${{ github.event.release.tag_name }}.zip . -x "node_modules/*" ".git/*" "src/*" ".github/*" "tsconfig.json" "README.md" "package.json" "package-lock.json" ".gitignore" "*.zip" | |
echo "✨ Done!" | |
- name: Create MC Pack file | |
run: | | |
echo "📚 Packaging to .mcpack from MC Pack File" | |
cp CCBG_${{ github.event.release.tag_name }}.zip CCBG_${{ github.event.release.tag_name }}.mcpack | |
echo "✨ Done!" | |
- name: Create Minecraft Preview Pack file | |
run: | | |
echo "📚 Creating directory structure for Minecraft Preview Pack" | |
mkdir CCBG_PREVIEW | |
rsync -av --exclude='node_modules' --exclude='.git' --exclude='CCBG_PREVIEW' --exclude='*.zip' --exclude='.github' --exclude='src' --exclude='tsconfig.json' --exclude='README.md' --exclude='package.json' --exclude='package-lock.json' --exclude='.gitignore' ./ CCBG_PREVIEW/ | |
node .github/workflow-script/updatePreviewManifest.js | |
echo "📚 Creating MC Pack file for Preview" | |
cd CCBG_PREVIEW | |
zip -r ../mc_pack_preview.zip . -x "node_modules/*" ".git/*" "*.zip" "*.mcpack" | |
cd .. | |
cp mc_pack_preview.zip CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.mcpack | |
echo "📚 Creating ZIP file for Minecraft Preview" | |
zip -r CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.zip CCBG_PREVIEW -x "node_modules/*" ".git/*" "*.zip" "*.mcpack" | |
echo "📚 Cleaning up" | |
rm -rf CCBG_PREVIEW | |
echo "✨ Done!" | |
- name: Create MC Addon file | |
run: | | |
echo "📚 Creating directory structure for .mcaddon" | |
mkdir -p CCBG | |
unzip mc_pack.zip -d CCBG | |
zip -r CCBG_${{ github.event.release.tag_name }}.mcaddon CCBG | |
echo "📚 Cleaning up" | |
rm -rf CCBG | |
echo "✨ Done!" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CCBG_${{ github.event.release.tag_name }} | |
path: | | |
CCBG_${{ github.event.release.tag_name }}.zip | |
CCBG_${{ github.event.release.tag_name }}.mcaddon | |
CCBG_${{ github.event.release.tag_name }}.mcpack | |
CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.mcpack | |
CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.zip | |
- name: Create release assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
CCBG_${{ github.event.release.tag_name }}.zip | |
CCBG_${{ github.event.release.tag_name }}.mcaddon | |
CCBG_${{ github.event.release.tag_name }}.mcpack | |
CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.mcpack | |
CCBG_${{ github.event.release.tag_name }}_Minecraft_PREVIEW.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |