Skip to content

Upload Release Asset #50

Upload Release Asset

Upload Release Asset #50

Workflow file for this run

name: Upload Release Asset
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '24'
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run build
- name: Zip the code
run: zip -r source_code.zip . -i functions/* scripts/* structures/* LICENSE manifest.json pack_icon.png package.json README.md
- name: Rename the file
run: |
REPO_NAME=$(echo ${{ github.repository }} | awk -F / '{print $2}')
TAG_NAME=${{ github.event.release.tag_name }}
FILE_NAME=$REPO_NAME-$TAG_NAME.mcpack
mv source_code.zip $FILE_NAME
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/octet-stream