Skip to content

Commit

Permalink
feat: unify addressable and non-addressable workflows (#37)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The ISceneManager, ISceneLoader and ILoadSceneInfo interfaces have been changed to accomodate the unification of addressable and non-addressable workflows. Refer to the migration guide at https://github.com/mygamedevtools/scene-loader/wiki/Migration-Guide-3.x for more details
  • Loading branch information
joaoborks authored Jun 19, 2024
1 parent 7017447 commit 68e93f3
Show file tree
Hide file tree
Showing 149 changed files with 3,096 additions and 3,402 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 🚀 Release (Preview)
on:
push:
branches:
- 'feat/**'
- 'fix/**'
paths-ignore:
- '**.md'

jobs:
create-preview-release:
name: Pre Release
uses: ./.github/workflows/release-template.yml
with:
blockPullRequestRelease: false
blockReleaseCommit: true
secrets:
githubToken: ${{ secrets.GH_TOKEN }}

91 changes: 91 additions & 0 deletions .github/workflows/release-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: 🚀 Release Package
on:
workflow_call:
inputs:
blockPullRequestRelease:
required: false
type: boolean
default: true
blockReleaseCommit:
required: false
type: boolean
dryRun:
required: false
type: boolean
secrets:
githubToken:
required: true

jobs:
semantic-release:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.release.outputs.new_release_published }}
new_release_version: ${{ steps.release.outputs.new_release_version }}
steps:
- name: 📂 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# Removes the git plugin from semantic release so it doesn't generate a new commit
- name: ✂️ Disable semantic release commit
if: ${{ inputs.blockReleaseCommit == true }}
run: |
cat .releaserc.json | jq 'del(.plugins[] | select(type == "array" and .[0] == "@semantic-release/git"))' .releaserc.json > .releaserc.json.tmp && mv .releaserc.json.tmp .releaserc.json
- name: 🚀 Semantic Release
id: release
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: ${{ inputs.dryRun }}
ci: ${{ inputs.blockPullRequestRelease }}
env:
GH_TOKEN: ${{ secrets.githubToken }}
- name: 📄 Summary
run: |
if [ '${{ steps.release.outputs.new_release_published }}' == 'true' ] && [ '${{ inputs.dryRun }}' == 'false' ]; then
echo "ℹ️ Released version \`${{ steps.release.outputs.new_release_version }}\`" | tee -a $GITHUB_STEP_SUMMARY
else
echo "ℹ️ No version released" | tee -a $GITHUB_STEP_SUMMARY
fi
package-upm:
runs-on: ubuntu-latest
needs: 'semantic-release'
if: ${{ needs.semantic-release.outputs.new_release_published == 'true' && inputs.dryRun == false }}
env:
releaseVersion: ${{ needs.semantic-release.outputs.new_release_version }}
steps:
- name: 📂 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📤 Extract Path
id: extract-path
run: |
PACKAGE_PATH=$(jq -r '.plugins[] | select(type == "array" and .[0] == "@semantic-release/npm") | .[1].pkgRoot' .releaserc.json)
echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV
- name: ✏️ Update package.json
run: |
jq '.version = "${{ env.releaseVersion }}"' $PACKAGE_PATH/package.json > package.json.tmp && mv package.json.tmp $PACKAGE_PATH/package.json
- name: 📦 Package UPM Branch
id: package_upm
run: |
git config --global user.name 'semantic-release-bot'
git config --global user.email '[email protected]'
git commit -am "update package.json"
git branch -d upm &> /dev/null || echo upm branch not found
git subtree split -P "$PACKAGE_PATH" -b upm
git checkout upm
if [[ -d "Samples" ]]; then
git mv Samples Samples~
rm -f Samples.meta
git commit -am "fix: Samples => Samples~"
fi
git push -f -u origin upm
- name: 🏷️ Create UPM Tag
run: |
git tag $TAG upm
git push origin --tags
env:
TAG: upm/${{ env.releaseVersion }}
60 changes: 10 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
name: Release
name: 🚀 Release
on:
push:
branches:
- main
- 'main'
paths-ignore:
- '**.md'

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Semantic Release
id: semantic
uses: cycjimmy/[email protected]
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
branch: main
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Post Release Checkout
id: post_release
uses: actions/checkout@v3
if: steps.semantic.outputs.new_release_published == 'true'
with:
ref: ${{ steps.semantic.outputs.new_release_version }}
- name: Split UPM Branch
id: split_upm
if: steps.post_release.outcome == 'success'
run: |
git branch -d upm &> /dev/null || echo upm branch not found
git subtree split -P "$PKG_ROOT" -b upm
git checkout upm
if [[ -d "Samples" ]]; then
git mv Samples Samples~
rm -f Samples.meta
git config --global user.name 'github-bot'
git config --global user.email '[email protected]'
git commit -am "fix: Samples => Samples~"
fi
git push -f -u origin upm
env:
PKG_ROOT: Packages/mygamedevtools-scene-loader
- name: Create UPM Tag
if: steps.split_upm.outcome == 'success'
run: |
git tag $TAG upm
git push origin --tags
env:
TAG: upm/${{ steps.semantic.outputs.new_release_version }}
create-release:
name: Release
uses: ./.github/workflows/release-template.yml
secrets:
githubToken: ${{ secrets.GH_TOKEN }}
21 changes: 11 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Test

name: 🧪 Tests
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'

jobs:
test:
Expand All @@ -15,18 +18,16 @@ jobs:
strategy:
fail-fast: false
matrix:
project-path:
- ./
testMode:
- playmode
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
lfs: true
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ matrix.project-path }}/Library
key: Library-${{ matrix.project-path }}
path: Library
key: Library
restore-keys: |
Library-
- uses: game-ci/unity-test-runner@v4
Expand All @@ -36,14 +37,14 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ matrix.project-path }}
projectPath: ./
testMode: ${{ matrix.testMode }}
artifactsPath: ${{ matrix.testMode }}-artifacts
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: ${{ matrix.testMode }} Test Results
coverageOptions: 'generateAdditionalMetrics;assemblyFilters:+MyGameDevTools.SceneLoading'
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
name: PlayMode
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
57 changes: 47 additions & 10 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
{
"branches": [
"main",
{
"name": "feat/*",
"prerelease": "pre"
},
{
"name": "fix/*",
"prerelease": "pre"
}
],
"tagFormat": "${version}",
"plugins": [
["@semantic-release/commit-analyzer", { "preset": "angular" }],
[
"@semantic-release/commit-analyzer",
{
"preset": "angular"
}
],
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogTitle": "# Changelog"
}],
["@semantic-release/npm", { "npmPublish": false, "pkgRoot": "Packages/mygamedevtools-scene-loader" }],
["@semantic-release/git", {
"assets": ["Packages/mygamedevtools-scene-loader/package.json", "CHANGELOG.md"],
"message": "ci(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
"@semantic-release/github"
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false,
"pkgRoot": "Packages/com.mygamedevtools.scene-loader",
"tarballDir": "dist"
}
],
[
"@semantic-release/git",
{
"assets": [
"Packages/com.mygamedevtools.scene-loader/package.json",
"CHANGELOG.md"
],
"message": "ci(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github",
{
"assets": "dist/*.tgz"
}
]
]
}
17 changes: 2 additions & 15 deletions Assets/AddressableAssetsData/AssetGroups/Built In Data.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,9 @@ MonoBehaviour:
m_Name: Built In Data
m_EditorClassIdentifier:
m_GroupName: Built In Data
m_Data:
m_SerializedData: []
m_GUID: 69e2a0fa8a80ce6419d62220d3567314
m_SerializeEntries:
- m_GUID: Resources
m_Address: Resources
m_ReadOnly: 1
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: EditorSceneList
m_Address: EditorSceneList
m_ReadOnly: 1
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_SerializeEntries: []
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: 4fd7c678d1436b34a865a71c5991863a, type: 2}
m_SchemaSet:
m_Schemas:
- {fileID: 11400000, guid: 7750edb8c58ebd04185cc1da949ab023, type: 2}
m_Schemas: []
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ MonoBehaviour:
m_Name: Default Local Group
m_EditorClassIdentifier:
m_GroupName: Default Local Group
m_Data:
m_SerializedData: []
m_GUID: 0d3a67d625bcc714ab7f6841b976b661
m_SerializeEntries: []
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 4fd7c678d1436b34a865a71c5991863a, type: 2}
m_SchemaSet:
m_Schemas:
- {fileID: 11400000, guid: edc8f0ba39310194bb6a99379a51c2fc, type: 2}
- {fileID: 11400000, guid: 59687c0da6aab784897f7abeeeeea606, type: 2}
- {fileID: 11400000, guid: edc8f0ba39310194bb6a99379a51c2fc, type: 2}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# [3.0.0-pre.8](https://github.com/mygamedevtools/scene-loader/compare/3.0.0-pre.7...3.0.0-pre.8) (2024-06-15)


### Bug Fixes

* add addressable preprocessor to scenedatabuilder ([7720e1e](https://github.com/mygamedevtools/scene-loader/commit/7720e1e3f3c97c2f93ab9cf83f314f79b77f0e9f))
* test reusable workflow ([575af28](https://github.com/mygamedevtools/scene-loader/commit/575af284a41ae4a654a7a0d591661911d0a5e1bb))

## [2.3.2](https://github.com/mygamedevtools/scene-loader/compare/2.3.1...2.3.2) (2024-03-04)


Expand Down
Loading

0 comments on commit 68e93f3

Please sign in to comment.