Skip to content

chore: bump version to 5.2.0-beta.2 #64

chore: bump version to 5.2.0-beta.2

chore: bump version to 5.2.0-beta.2 #64

name: "🚀 Build and Publish Release"
on:
push:
tags: ["v*"]
jobs:
build:
uses: ./.github/workflows/build-prebuilds.yaml
package-and-publish:
name: "Package and Publish"
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
packages: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for tags
submodules: true
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build TypeScript
run: npm run build:tsc
- name: Download all prebuilds
uses: actions/download-artifact@v7
with:
pattern: prebuild-*
path: prebuilds-artifacts
- name: Download FFmpeg binaries
uses: actions/download-artifact@v7
with:
pattern: ffmpeg-v*
path: ffmpeg-binaries
- name: Prepare prebuilds structure
run: |
mkdir -p prebuilds
# Copy all prebuilds to a single directory structure
for dir in prebuilds-artifacts/*/; do
cp -r "$dir"* prebuilds/
done
echo "Combined prebuilds structure:"
ls -laR prebuilds/
# Verify we have all expected platforms
echo -e "\nVerifying platform coverage:"
for platform in darwin-x64 darwin-arm64 linux-x64 linux-arm64 win32-x64-mingw win32-arm64-mingw win32-x64-msvc win32-arm64-msvc; do
if [ -d "prebuilds/$platform" ]; then
echo "✓ $platform"
else
echo "✗ $platform missing"
exit 1
fi
done
- name: Create platform packages
run: |
node scripts/create-platform-packages.js
# Compress and copy prebuilds to platform packages (already named node-av.node)
for platform in darwin-x64 darwin-arm64 linux-x64 linux-arm64 win32-x64-mingw win32-arm64-mingw win32-x64-msvc win32-arm64-msvc; do
if [ -d "prebuilds/$platform" ]; then
# Create ZIP containing the .node file
cd "prebuilds/$platform"
zip -9 "../../packages/$platform/node-av.node.zip" node-av.node
cd ../..
echo "Compressed and copied binary for $platform"
fi
done
echo "Platform packages created:"
ls -la packages/
for pkg in packages/*/; do
echo "Contents of $pkg:"
ls -la "$pkg"
done
- name: Update version
run: |
# Extract version from tag
VERSION="${GITHUB_REF#refs/tags/v}"
echo "Version: $VERSION"
# Check if main package needs version update
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [ "$CURRENT_VERSION" != "$VERSION" ]; then
echo "Updating main package version from $CURRENT_VERSION to $VERSION"
npm version $VERSION --no-git-tag-version
else
echo "Main package already at version $VERSION"
fi
# Update platform package versions
for pkg in packages/*/package.json; do
if [ -f "$pkg" ]; then
cd $(dirname "$pkg")
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$PKG_VERSION" != "$VERSION" ]; then
echo "Updating $(basename $(dirname "$pkg")) from $PKG_VERSION to $VERSION"
npm version $VERSION --no-git-tag-version
else
echo "$(basename $(dirname "$pkg")) already at version $VERSION"
fi
cd -
fi
done
- name: Create release archives
run: |
# Create archives for each platform (including new Windows variants)
for platform in darwin-x64 darwin-arm64 linux-x64 linux-arm64 win32-x64-mingw win32-arm64-mingw win32-x64-msvc win32-arm64-msvc; do
if [ -d "prebuilds/$platform" ]; then
zip -r "node-av-${platform}-${GITHUB_REF#refs/tags/}.zip" "prebuilds/$platform"
echo "Created: node-av-${platform}-${GITHUB_REF#refs/tags/}.zip"
fi
done
# Copy FFmpeg binaries to root for release
if [ -d "ffmpeg-binaries" ]; then
echo "Copying FFmpeg binaries for release:"
for ffmpeg_dir in ffmpeg-binaries/*/; do
if [ -d "$ffmpeg_dir" ]; then
# Extract the artifact name from directory
artifact_name=$(basename "$ffmpeg_dir")
echo "Processing FFmpeg artifact: $artifact_name"
# Create zip files for each FFmpeg binary
if [ -d "$ffmpeg_dir" ] && [ "$(ls -A "$ffmpeg_dir")" ]; then
cd "$ffmpeg_dir"
zip -r "../../${artifact_name}" *
cd ../..
echo "Created: ${artifact_name}"
fi
fi
done
fi
echo "All release archives created:"
ls -la *.zip
- name: Generate release notes from CHANGELOG
id: release_notes
run: |
# Extract version without 'v' prefix
VERSION="${{ github.ref_name }}"
VERSION_NO_V="${VERSION#v}"
# Check if this is a beta release
IS_BETA="false"
if [[ "$VERSION_NO_V" == *"-beta."* ]]; then
IS_BETA="true"
# Extract base version (e.g., 5.2.0 from 5.2.0-beta.1)
BASE_VERSION="${VERSION_NO_V%%-beta.*}"
fi
# Start building the release body
echo "" > release_notes.md
# Beta warning at the top
if [ "$IS_BETA" = "true" ]; then
echo "> ⚠️ This is a pre-release version for testing. Install with: \`npm install node-av@beta\`" >> release_notes.md
echo "" >> release_notes.md
fi
# Extract the specific version section from CHANGELOG.md (only for stable releases)
if [ "$IS_BETA" = "false" ] && [ -f "CHANGELOG.md" ]; then
VERSION_CONTENT=$(sed -n "/## \[${VERSION_NO_V}\]/,/## \[/p" CHANGELOG.md | sed '$d')
if [ -n "$VERSION_CONTENT" ]; then
echo "$VERSION_CONTENT" | tail -n +2 >> release_notes.md
echo "" >> release_notes.md
fi
fi
# Find the last stable tag (not a beta tag) for commit history
LAST_STABLE_TAG=$(git tag -l 'v*' | grep -v '\-beta\.' | sort -V | tail -1)
echo "Last stable tag: $LAST_STABLE_TAG"
if [ -n "$LAST_STABLE_TAG" ] && [ "$LAST_STABLE_TAG" != "${{ github.ref_name }}" ]; then
echo "### 📋 All Changes since $LAST_STABLE_TAG" >> release_notes.md
echo "" >> release_notes.md
git log --pretty=format:"- %s (%h) - @%an" $LAST_STABLE_TAG..${{ github.ref_name }} >> release_notes.md
echo "" >> release_notes.md
fi
# Platform packages at the end
cat >> release_notes.md << EOF
The following platform packages have been updated to v$VERSION_NO_V:
- \`@seydx/node-av-darwin-arm64@$VERSION_NO_V\`
- \`@seydx/node-av-darwin-x64@$VERSION_NO_V\`
- \`@seydx/node-av-linux-arm64@$VERSION_NO_V\`
- \`@seydx/node-av-linux-x64@$VERSION_NO_V\`
- \`@seydx/node-av-win32-arm64-mingw@$VERSION_NO_V\`
- \`@seydx/node-av-win32-x64-mingw@$VERSION_NO_V\`
- \`@seydx/node-av-win32-arm64-msvc@$VERSION_NO_V\`
- \`@seydx/node-av-win32-x64-msvc@$VERSION_NO_V\`
EOF
# Output the release notes
cat release_notes.md
- name: Determine NPM tag
id: npm_tag
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
echo "Version: $VERSION"
# Determine NPM dist-tag based on version
if [[ "$VERSION" == *"-beta."* ]]; then
echo "tag=beta" >> $GITHUB_OUTPUT
echo "NPM tag: beta"
else
echo "tag=latest" >> $GITHUB_OUTPUT
echo "NPM tag: latest"
fi
- name: Publish to NPM
run: |
NPM_TAG="${{ steps.npm_tag.outputs.tag }}"
echo "Publishing with tag: $NPM_TAG"
# Publish platform packages
for pkg_dir in packages/*/; do
if [ -d "$pkg_dir" ]; then
cd "$pkg_dir"
npm publish --access public --tag "$NPM_TAG"
cd -
fi
done
# Publish main package
npm publish --access public --tag "$NPM_TAG"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Delete existing pre-release
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
# Find and delete ALL existing pre-releases (we only keep one at a time)
echo "Deleting all existing pre-releases..."
RELEASES=$(gh release list --json tagName,isPrerelease -q ".[] | select(.isPrerelease == true) | .tagName" 2>/dev/null || echo "")
for TAG in $RELEASES; do
if [ "$TAG" != "v$VERSION" ]; then
echo "Deleting pre-release: $TAG"
gh release delete "$TAG" --yes --cleanup-tag 2>/dev/null || true
fi
done
env:
GH_TOKEN: ${{ github.token }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: "*.zip"
body_path: release_notes.md
prerelease: ${{ steps.npm_tag.outputs.tag == 'beta' }}