Skip to content

feat: add pnpm and changesets to manage repository #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@godot-js/jsb-static",
"@godot-js/jsb-runtime",
"@godot-js/jsb-editor"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ jobs:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ jobs:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Setup Python and SCons
if: "!matrix.legacy-scons"
uses: ./.github/actions/godot-deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ jobs:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Compilation (x86_64)
uses: ./.github/actions/godot-build
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ jobs:
lfs: true
submodules: recursive

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v14
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ jobs:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8

- name: Download out
uses: actions/download-artifact@v4
with:
name: out
path: ${{github.workspace}}/modules/GodotJS/scripts/out

- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/misc_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: 🌳 Set Environment
on:
workflow_call:
outputs:
version:
description: "Godot version"
value: ${{ jobs.environment.outputs.version }}
v8:
description: "V8 version"
value: ${{ jobs.environment.outputs.v8 }}
publish:
description: "Should publish"
value: ${{ jobs.environment.outputs.publish }}

jobs:
environment:
name: 🌳 Set Environment
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versions.outputs.version }}
v8: ${{ steps.versions.outputs.v8 }}
publish: ${{ steps.should_publish.outputs.publish }}
steps:
- name: ⏬ Checkout repository
uses: actions/checkout@v4

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

- name: 🦕❌ Setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: 🛠️ Build scripts/out
run: |
pnpm install
pnpm build

- name: ⬆️ Upload scripts/out
uses: actions/upload-artifact@v4
with:
name: out
path: ${{github.workspace}}/scripts/out
retention-days: 10

- name: 🏷 Set Versions
id: versions
run: |
echo "version=4.4" >> $GITHUB_OUTPUT
echo "v8=v8_12.4.254.21_r13" >> $GITHUB_OUTPUT

- name: 🎱 Deps v8
shell: bash
env:
V8: ${{ steps.versions.outputs.v8 }}
run: |
curl -L -o "$V8.zip" "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/$V8/$V8.zip"
unzip "$V8.zip" -d "/tmp/$V8"
mkdir -p "${{github.workspace}}/modules/GodotJS/"
mv "/tmp/$V8/v8" "${{github.workspace}}/modules/GodotJS/v8"
ls "${{github.workspace}}/modules/GodotJS/v8"

- name: ⬆️ Upload v8
uses: actions/upload-artifact@v4
with:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8
retention-days: 10

- name: 🆚 Create and publish versions
id: changesets
uses: changesets/action@v1
with:
commit: "chore: update versions"
title: "chore: update versions"
version: pnpm ci:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: ❓ Should publish
id: should_publish
env:
HAS_CHANGESETS: ${{ steps.changesets.outputs.hasChangesets }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SHOULD_PUBLISH=$(pnpm run ci:should-publish)
if [[ $SHOULD_PUBLISH == "true" && $HAS_CHANGESETS == "false" ]]; then
echo "publish=true" >> $GITHUB_OUTPUT
else
echo "publish=false" >> $GITHUB_OUTPUT
fi
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,43 @@ permissions:
contents: write

jobs:
rename:
release:
runs-on: ubuntu-latest
outputs:
id: ${{ steps.publish_release.outputs.id }}
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 📛 Add version to release name
uses: actions/github-script@v6
- name: 🛫 Setup pnpm
uses: pnpm/action-setup@v4

- name: 🦕❌ Setup node.js
uses: actions/setup-node@v4
with:
result-encoding: json
script: |
const { repo, owner } = context.repo;
await github.rest.repos.updateRelease({
owner,
repo,
release_id: context.payload.release.id,
name: '${{ inputs.version }}-${{ inputs.v8 }}-' + context.payload.release.name,
});
node-version: 20
cache: "pnpm"

release:
- name: 🔄️ Install dependencies
run: pnpm install

- name: 🚢 Publish release
id: publish_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pnpm ci:publish ${{ inputs.version }} ${{ inputs.v8 }}
RELEASE_ID=$(gh release view ${{ inputs.version }} --json id --jq ".id")
echo "id=$RELEASE_ID" >> $GITHUB_OUTPUT

upload-assets:
runs-on: ubuntu-latest
name: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.engine }}
needs: [ release ]
strategy:
fail-fast: false
matrix:
engine: [ v8,qjs-ng ]
engine: [ v8, qjs-ng ]
os: [ android, ios, linux, macos, web, web-nothreads, windows ]
target: [ template-release ]
include:
Expand Down Expand Up @@ -87,7 +98,7 @@ jobs:
return await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: context.payload.release.id,
release_id: ${{ needs.release.outputs.id }},
name: '${{ steps.name.outputs.name }}.zip',
data: FS.readFileSync('${{ github.workspace }}/${{ steps.name.outputs.name }}.zip')
});
54 changes: 13 additions & 41 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
push:
branches:
- "main"
release:
types: [ published ]
schedule:
- cron: "2 0 * * 0" # Sunday after midnight to trigger a release

concurrency:
group: ${{ github.workflow }}|${{ github.ref_name }}
Expand All @@ -20,74 +20,46 @@ permissions:
jobs:
environment:
name: 🌳 Set Environment
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versions.outputs.version }}
v8: ${{ steps.versions.outputs.v8 }}
steps:
- name: 🏷 Set Versions
id: versions
run: |
echo "version=4.4" >> $GITHUB_OUTPUT
echo "v8=v8_12.4.254.21_r13" >> $GITHUB_OUTPUT

- name: 🎱 Deps v8
shell: bash
env:
V8: ${{ steps.versions.outputs.v8 }}
run: |
curl -L -o "$V8.zip" "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/$V8/$V8.zip"
unzip "$V8.zip" -d "/tmp/$V8"
mkdir -p "${{github.workspace}}/modules/GodotJS/"
mv "/tmp/$V8/v8" "${{github.workspace}}/modules/GodotJS/v8"
ls "${{github.workspace}}/modules/GodotJS/v8"


- name: ⬆️ Upload artifact
uses: actions/upload-artifact@v4
with:
name: V8
path: ${{github.workspace}}/modules/GodotJS/v8
retention-days: 10
uses: ./.github/workflows/misc_environment.yml

android-build:
name: 🤖 Android
uses: ./.github/workflows/android_builds.yml
uses: ./.github/workflows/build_android.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}

ios-build:
name: 🍏 iOS
uses: ./.github/workflows/ios_builds.yml
uses: ./.github/workflows/build_ios.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}

linux-build:
name: 🐧 Linux
uses: ./.github/workflows/linux_builds.yml
uses: ./.github/workflows/build_linux.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}

macos-build:
name: 🍎 macOS
uses: ./.github/workflows/macos_builds.yml
uses: ./.github/workflows/build_macos.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}

windows-build:
name: 🏁 Windows
uses: ./.github/workflows/windows_builds.yml
uses: ./.github/workflows/build_windows.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}

web-build:
name: 🌐 Web
uses: ./.github/workflows/web_builds.yml
uses: ./.github/workflows/build_web.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}
Expand Down Expand Up @@ -127,14 +99,14 @@ jobs:
macos-build,
linux-build,
ios-build,
android-build
android-build,
]

release:
name: 🦅 Release
if: github.event_name == 'release' && github.event.action == 'published'
needs: [ checks-done, environment ]
uses: ./.github/workflows/release_builds.yml
if: needs.environment.outputs.publish == 'true' && github.event_name != 'pull_request'
needs: [checks-done, environment]
uses: ./.github/workflows/misc_release.yml
secrets: inherit
with:
version: ${{ needs.environment.outputs.version }}
Expand Down
Loading
Loading