Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/actions/emsdk-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "emsdk install"
description: "Install emsdk with cache enabled"
inputs:
version:
description: "Emscripten version"
default: "4.0.23"
cache-folder:
description: "Cache folder"
default: "emsdk-cache"
runs:
using: "composite"
steps:
- name: Set up swap space
if: runner.os == 'Linux'
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 10

- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT

- name: Setup emsdk cache
uses: actions/cache@v4
with:
path: ${{ inputs.cache-folder }}
key: ${{ runner.os }}-emsdk-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ inputs.version }}
restore-keys: |
${{ runner.os }}-emsdk-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-

- name: Install emsdk
uses: pyodide/setup-emsdk@v15
with:
version: ${{ inputs.version }}
actions-cache-folder: ${{ inputs.cache-folder }}
cache-key: ${{ runner.os }}-emsdk-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ inputs.version }}
38 changes: 38 additions & 0 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: prepare
description: Prepare action
inputs:
node-install:
description: Install node
default: "true"
pnpm-install:
description: Install pnpm depedencies
default: "true"
emsdk-install:
description: Install emscriptens
default: "true"
build:
description: Build packages
default: "true"
runs:
using: composite
steps:
- if: inputs.node-install == 'true'
name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
registry-url: https://registry.npmjs.org

- if: inputs.pnpm-install == 'true'
name: Install dependencies
uses: ./.github/actions/pnpm-install

- if: inputs.emsdk-install == 'true'
name: Install emsdk
uses: ./.github/actions/emsdk-install

- if: inputs.build == 'true'
name: Build packages
shell: bash
run: pnpm run build
4 changes: 1 addition & 3 deletions .github/workflows/label-sync.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: "Label sync"
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
Expand All @@ -18,7 +16,7 @@ jobs:
if: github.repository_owner == 'NanoForge-dev'
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Label sync
uses: crazy-max/ghaction-github-labeler@v5
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Pre-Release

on:
workflow_dispatch:
inputs:
package:
description: "The published name of a single package to release"
type: choice
required: true
options:
- "@nanoforge-dev/actions"
- "@nanoforge-dev/asset-manager"
- "@nanoforge-dev/common"
- "@nanoforge-dev/config"
- "@nanoforge-dev/core"
- "@nanoforge-dev/docgen"
- "@nanoforge-dev/ecs-client"
- "@nanoforge-dev/ecs-lib"
- "@nanoforge-dev/ecs-server"
- "@nanoforge-dev/graphics-2d"
- "@nanoforge-dev/input"
- "@nanoforge-dev/music"
- "@nanoforge-dev/network-client"
- "@nanoforge-dev/network-server"
- "@nanoforge-dev/sound"
- "@nanoforge-dev/utils-eslint-config"
- "@nanoforge-dev/utils-prettier-config"
version:
description: "New version of the package (leave empty for auto generated version)"
type: string
required: false
dry_run:
description: Perform a dry run?
type: boolean
default: false

permissions:
contents: write

jobs:
create-release-pr:
name: Create release pr
runs-on: ubuntu-latest
if: github.repository_owner == 'NanoForge-dev'
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Prepare
uses: ./.github/actions/prepare

- name: Release packages
uses: ./utils/actions/dist/create-release-pr
with:
package: ${{ inputs.package }}
version: ${{ inputs.version }}
dry: ${{ inputs.dry_run }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
pull_request:
types:
- closed
branches:
- main

permissions:
contents: write

jobs:
create-release-tag:
name: Create release tag
runs-on: ubuntu-latest
if: github.repository_owner == 'NanoForge-dev' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/')
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Prepare
uses: ./.github/actions/prepare

- name: Create release tag
uses: ./utils/actions/dist/create-release-tag
with:
commit: ${{ github.sha }}
branch: ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 2 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ on:
type: boolean
default: false

env:
EM_CACHE_FOLDER: "emsdk-cache"

permissions:
contents: write

Expand All @@ -50,23 +47,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6

- name: Install Node.js v24
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
registry-url: https://registry.npmjs.org/

- name: Install dependencies
uses: ./utils/actions/src/pnpm-install

- name: "Install emscipten"
uses: "mymindstorm/setup-emsdk@v14"
with:
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}

- name: Build dependencies
run: pnpm run build
- name: Prepare
uses: ./.github/actions/prepare

- name: Release packages
uses: ./utils/actions/dist/release-packages
Expand Down
34 changes: 8 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,20 @@ on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
workflow_dispatch:

env:
EM_CACHE_FOLDER: "emsdk-cache"

jobs:
checkout:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: "Setup pnpm"
uses: pnpm/action-setup@v4

- name: "Setup node"
uses: actions/setup-node@v4
with:
node-version: 24.11.0
cache: "pnpm"

- name: "Install dependencies"
run: pnpm install

- name: "Install emscipten"
uses: "mymindstorm/setup-emsdk@v14"
with:
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Checkout repository
uses: actions/checkout@v6

- name: "Run build"
run: pnpm build
- name: Prepare
uses: ./.github/actions/prepare

- name: "Run tests"
run: pnpm test:unit
Expand Down
Loading
Loading