Skip to content

[Feat] Add positional data towards monsters #4

[Feat] Add positional data towards monsters

[Feat] Add positional data towards monsters #4

Workflow file for this run

name: Build & Release
permissions:
contents: write
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag to release (optional). If empty, the pushed tag name will be used.'
required: false
default: ''
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
target: win
artifact_name: windows-dist
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install system dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
Write-Host "Skipping Npcap installation for CI build"
Write-Host "If packet capture functionality is needed, users should install Npcap manually"
Write-Host "from https://npcap.com/#download"
shell: pwsh
- name: Install dependencies
run: npm ci
- name: Build renderer and TypeScript
run: npm run build:all
env:
VITE_BPTIMER_DB_URL: ${{ secrets.VITE_BPTIMER_DB_URL }}
VITE_BPTIMER_API_KEY: ${{ secrets.VITE_BPTIMER_API_KEY }}
- name: Package (electron-builder)
run: npx electron-builder --${{ matrix.target }} --x64 --publish=never
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
dist_electron/
dist/
retention-days: 1
release:
name: Create Draft Release and Attach Assets
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List downloaded artifacts
run: |
echo "Artifact structure:"
find ./artifacts -type f -name "*" | head -20
echo "Total files found:"
find ./artifacts -type f | wc -l
- name: Prepare release assets
run: |
# Create a clean releases directory
mkdir -p release_assets
# Copy and organize artifacts with better naming
if [ -d "./artifacts/windows-dist" ]; then
mkdir -p "release_assets/windows"
cp -r "./artifacts/windows-dist"/* "release_assets/windows/" 2>/dev/null || true
fi
echo "Final release assets structure:"
ls -la release_assets/
find release_assets/ -type f | head -20
- name: Compress release assets into zips
run: |
mkdir -p release_archives
ASSET_DIR="release_assets/windows"
if [ -d "${ASSET_DIR}" ]; then
echo "Creating archive for windows"
if [ -d "${ASSET_DIR}/dist_electron" ]; then
pushd "${ASSET_DIR}/dist_electron" >/dev/null
zip -r "${GITHUB_WORKSPACE:-.}/release_archives/windows.zip" . -x "builder-debug.yml" "*builder-debug.yml" "*.blockmap" "win-unpacked/*" "**/win-unpacked/*" >/dev/null || true
popd >/dev/null
else
pushd "${ASSET_DIR}" >/dev/null
zip -r "${GITHUB_WORKSPACE:-.}/release_archives/windows.zip" . -x "builder-debug.yml" "*builder-debug.yml" "*.blockmap" "win-unpacked/*" "**/win-unpacked/*" >/dev/null || true
popd >/dev/null
fi
ls -la "release_archives/windows.zip" || true
fi
echo "Archives produced:" && ls -la release_archives || true
- name: Determine release tag
id: tag_step
run: |
# If the user supplied a tag_name input, use it.
if [ -n "${{ github.event.inputs.tag_name }}" ]; then
echo "tag=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT
echo "skip=false" >> $GITHUB_OUTPUT
echo "Using tag: ${{ github.event.inputs.tag_name }}"
exit 0
fi
# If this run was triggered by a tag push, extract the tag name.
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG_NAME="${GITHUB_REF#refs/tags/}"
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "skip=false" >> $GITHUB_OUTPUT
echo "Using tag from push: ${TAG_NAME}"
exit 0
fi
# Not a tag push and no input provided — skip release creation to avoid attempts to release a branch ref.
echo "tag=" >> $GITHUB_OUTPUT
echo "skip=true" >> $GITHUB_OUTPUT
echo "No tag provided and this is not a tag push (GITHUB_REF=${GITHUB_REF}). Skipping release creation."
- name: Rename archives with tag and generate checksums
if: ${{ steps.tag_step.outputs.skip != 'true' }}
run: |
mkdir -p release_archives_final
TAG=${{ steps.tag_step.outputs.tag }}
REPO_NAME=$(basename $GITHUB_REPOSITORY)
for f in release_archives/*.zip; do
[ -f "$f" ] || continue
OSNAME=$(basename "$f" .zip)
# include architecture (builds are produced for x64)
OUTNAME="${REPO_NAME}-${TAG}-${OSNAME}-x64.zip"
cp "$f" "release_archives_final/${OUTNAME}"
sha256sum "release_archives_final/${OUTNAME}" | awk '{print $1}' > "release_archives_final/${OUTNAME}.sha256"
echo "Produced release_archives_final/${OUTNAME} and checksum"
done
ls -la release_archives_final || true
- name: Create Draft GitHub Release and upload archives
if: ${{ steps.tag_step.outputs.skip != 'true' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag_step.outputs.tag }}
name: ${{ steps.tag_step.outputs.tag }}
draft: true
files: |
release_archives_final/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Done
run: echo "Release created (draft) with artifacts attached."