Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
72f14ce
chore: updates
triniwiz May 18, 2025
2afbc80
chore: nx migrate @nativescript/plugin-tools
NathanWalker May 18, 2025
157afd3
chore: updates
triniwiz Jun 4, 2025
c39c29c
fix(canvas): support local paths
triniwiz Jun 15, 2025
03854aa
feat: GPUCompilationInfo
triniwiz Jun 15, 2025
c9feb6f
fix(canvas): clean up context
triniwiz Jun 15, 2025
7dae858
chore: rc12
triniwiz Jun 15, 2025
cd36597
chore: disable forceGL
triniwiz Jun 16, 2025
cb66829
fix: polyfills and media (#135)
herefishyfish Aug 27, 2025
ebc26d8
fix(canvas): filter out touch events by identifier (#136)
herefishyfish Aug 27, 2025
19d03cc
chore: bump
triniwiz Aug 27, 2025
eaf11e0
fix: webgl creation
triniwiz Aug 27, 2025
a01b41f
chore: bump
triniwiz Aug 27, 2025
5bd347b
chore: clean up
triniwiz Aug 27, 2025
840d0b1
chore: improve userAgent
triniwiz Aug 27, 2025
8f94caf
chore: bump
triniwiz Aug 27, 2025
07c7c6f
fix: expose CustomEvent
triniwiz Aug 27, 2025
70e6479
chore: bump
triniwiz Aug 27, 2025
3327cae
fix: webgl video rendering
triniwiz Aug 27, 2025
bea85dd
chore: bump
triniwiz Aug 27, 2025
df59db7
fix: flipY
triniwiz Aug 27, 2025
22ad3e9
chore: bump
triniwiz Aug 27, 2025
8f8ab04
fix(ios): video gl video rendering
triniwiz Sep 1, 2025
2b3f02e
feat: update wgpu & skia to the latest
triniwiz Sep 1, 2025
bd1e40e
chore: fixes & performance updates
triniwiz Apr 6, 2026
08fde0d
fix: image leaks
triniwiz Apr 6, 2026
18ffa23
chore(polyfil): polish
triniwiz Apr 6, 2026
1673b5b
feat: support video elements in drawImage, texImage2D, texSubImage2D,…
triniwiz Apr 6, 2026
dad2172
chore: 2.0
triniwiz Apr 6, 2026
21e2994
Potential fix for pull request finding 'CodeQL / Workflow does not co…
triniwiz Apr 6, 2026
8238e6a
Potential fix for pull request finding 'CodeQL / Workflow does not co…
triniwiz Apr 6, 2026
2ecc7ce
chore: bump
triniwiz Apr 6, 2026
1d7e203
chore: bump libs
triniwiz Apr 6, 2026
ef4fbb7
chore: v2
triniwiz Apr 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
242 changes: 242 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
name: Publish Packages

permissions:
contents: read
packages: read

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
npm_tag:
description: 'NPM tag to publish as (overrides default)'
required: false
default: 'latest'
dry_run:
description: 'Set to "true" to skip publishing and release upload (dry run)'
required: false
default: 'false'

permissions:
contents: read
env:
NPM_TAG: "latest"
NPM_PACKAGES: canvas,canvas-babylon,canvas-media,canvas-phaser,canvas-phaser-ce,canvas-pixi,canvas-polyfill,canvas-three,canvas-svg

jobs:
build-linux:
name: Build Linux native artifacts
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Cache node modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Use Rust nightly
run: rustup default nightly
- name: Install deps (root)
run: npm ci

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build Android (make android)
run: |
set -e
make android

- name: Copy AAR into package
run: |
set -e
./tools/scripts/copy-android.sh

- name: Upload Android platforms
uses: actions/upload-artifact@v4
with:
name: android-platforms
path: packages/canvas/platforms/android

build-macos:
name: Build macOS native artifacts
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Cache node modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Use Rust nightly
run: rustup default nightly
- name: Install root deps
run: npm ci

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build iOS (make ios)
run: |
set -e
make ios

- name: Build and copy iOS XCFramework
run: |
set -e
./tools/scripts/canvas-build.sh

- name: Upload iOS platforms
uses: actions/upload-artifact@v4
with:
name: ios-platforms
path: packages/canvas/platforms/ios

publish:
name: Publish to npm
runs-on: ubuntu-22.04
needs: [ build-linux, build-macos ]
steps:
- uses: actions/checkout@v4

- name: Download linux artifacts
uses: actions/download-artifact@v4
with:
name: napi-linux-artifacts
path: ./artifacts/linux

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Download mac artifacts
uses: actions/download-artifact@v4
with:
name: napi-macos-artifacts
path: ./artifacts/macos

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install root deps
run: npm ci

- name: Compute NPM_VERSION
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "Detected tag $TAG"
echo "NPM_VERSION=$TAG" >> $GITHUB_ENV
# set NPM_TAG to prefix of tag (e.g. rc/, beta) or the tag itself
echo "NPM_TAG=${TAG%%-*}" >> $GITHUB_ENV
else
if [ -n "${{ github.event.inputs.npm_tag }}" ]; then
NT="${{ github.event.inputs.npm_tag }}"
else
NT="$NPM_TAG"
fi
echo "NPM_TAG=$NT" >> $GITHUB_ENV
echo "NPM_VERSION=$(node -e \"console.log(require('./packages/canvas/package.json').version)\")-$NT-$(date +\"%Y%m%d\")-$GITHUB_RUN_ID" >> $GITHUB_ENV
fi

- name: Bump packages (no git tags)
run: |
for pkg in packages/canvas packages/canvas-babylon packages/canvas-media packages/canvas-phaser packages/canvas-phaser-ce packages/canvas-pixi packages/canvas-polyfill packages/canvas-three packages/canvas-svg; do
if [ -f "$pkg/package.json" ]; then
(cd "$pkg" && npm --no-git-tag-version version "$NPM_VERSION")
fi
done

- name: Create project .npmrc (in-repo)
if: ${{ secrets.NPM_PUBLISH_TOKEN != '' }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > .npmrc

- name: Build all packages
run: |
npx nx run canvas:build.all

- name: Publish packages
if: ${{ github.event.inputs.dry_run != 'true' }}
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "NPM token missing. Set secrets.NPM_PUBLISH_TOKEN to proceed." && exit 1
fi
echo "Publishing packages with version $NPM_VERSION and tag $NPM_TAG"
npm run publish-packages --name "$NPM_PACKAGES" --verify true --version "$NPM_VERSION" --tag "$NPM_TAG"

- name: Clean up .npmrc
if: always()
run: rm -f .npmrc || true

- name: Create release tarball
if: startsWith(github.ref, 'refs/tags/') && github.event.inputs.dry_run != 'true'
run: |
set -e
TAR_NAME=release-${NPM_VERSION}.tar.gz
tar -czf ${TAR_NAME} dist packages/canvas/platforms || true
echo "Created ${TAR_NAME}"

- name: Create GitHub release and upload assets
if: startsWith(github.ref, 'refs/tags/') && github.event.inputs.dry_run != 'true'
uses: softprops/action-gh-release@v1
with:
files: release-${NPM_VERSION}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55 changes: 54 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
env:
NPM_TAG: "pr"
EMULATOR_NAME: "runtime-emu"
NDK_VERSION: r23c
NDK_VERSION: r27d
ANDROID_API: 29
ANDROID_ABI: x86_64
NDK_ARCH: linux
Expand All @@ -24,6 +24,24 @@
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
Expand Down Expand Up @@ -137,6 +155,24 @@
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
with:
path: |
~/.npm
~/.cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
Expand Down Expand Up @@ -190,6 +226,7 @@
npm run build.canvas.ios.framework.release
npm:
name: Npm Build
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
needs: [android, ios]
outputs:
Expand Down Expand Up @@ -251,4 +288,20 @@
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc
echo "Publishing @nativescript/canvas@$NPM_VERSION to NPM with tag $NPM_TAG..."
npm run publish-packages --name $NPM_PACKAGES --verify true --version $NPM_VERSION
pr-notice:
name: PR Publish Notice
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: [ android, ios ]
steps:
- uses: actions/checkout@v4
- name: Post PR comment about publishing
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:information_source: Note: npm publishing is disabled for pull requests.
Publishing is performed only from tag pushes via the `Publish Packages` workflow.
If you need a test publish, create a tag `v0.0.0-rc.test` and push it to trigger a release run.

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Loading
Loading