chore: release workflow
parent
4c5b1287a4
commit
2f4a963a56
|
@ -0,0 +1,87 @@
|
||||||
|
name: 🔖 Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- preview
|
||||||
|
- release
|
||||||
|
tags-ignore:
|
||||||
|
- "**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: 🔖 Release (${{ github.ref_name }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
outputs:
|
||||||
|
channel: ${{ steps.release.outputs.new_release_channel }}
|
||||||
|
released: ${{ steps.release.outputs.new_release_published }}
|
||||||
|
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||||
|
version: ${{ steps.release.outputs.new_release_version }}
|
||||||
|
notes: ${{ steps.release.outputs.new_release_notes }}
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 🔖 Run semantic release
|
||||||
|
uses: cycjimmy/semantic-release-action@v4
|
||||||
|
id: release
|
||||||
|
with:
|
||||||
|
working_directory: Packages/src
|
||||||
|
extra_plugins: |
|
||||||
|
@semantic-release/changelog
|
||||||
|
@semantic-release/git
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
echo "🔖 New release version: '${{ steps.release.outputs.new_release_version }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
echo "🔖 New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
echo "🔖 New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
echo '${{ steps.release.outputs.new_release_notes }}' | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
merge-to-develop:
|
||||||
|
if: needs.release.outputs.released == 'true'
|
||||||
|
needs: release
|
||||||
|
name: 🔀 Merge to develop
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout (develop)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: develop
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 🔀 Merge '${{ needs.release.outputs.tag }}' into 'develop'
|
||||||
|
run: |
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
git merge ${{ needs.release.outputs.tag }}
|
||||||
|
git push origin develop
|
||||||
|
|
||||||
|
split-to-main:
|
||||||
|
if: needs.release.outputs.released == 'true'
|
||||||
|
needs: release
|
||||||
|
name: 🔀 Split package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout (${{ needs.release.outputs.tag }})
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.release.outputs.tag }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 🔀 Split subtree 'Packages/src' to 'main'
|
||||||
|
run: |
|
||||||
|
git branch main origin/main
|
||||||
|
git subtree split --prefix=Packages/src --branch main
|
||||||
|
git tag ${{ needs.release.outputs.version }} main
|
||||||
|
git push origin ${{ needs.release.outputs.version }} main:main
|
|
@ -0,0 +1,88 @@
|
||||||
|
# Required secrets
|
||||||
|
# UNITY_LICENSE: The contents of Unity license file
|
||||||
|
name: 🧪 Test
|
||||||
|
|
||||||
|
env:
|
||||||
|
# MINIMUM_VERSION: The minimum version of Unity.
|
||||||
|
MINIMUM_VERSION: 2019.4
|
||||||
|
EXCLUDE_FILTER: '(2020.2.0)'
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
tags:
|
||||||
|
- "!*"
|
||||||
|
paths-ignore:
|
||||||
|
- "*.md"
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: ⚙️ Setup
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
unityVersions: ${{ steps.setup.outputs.unityVersions }}
|
||||||
|
steps:
|
||||||
|
- name: ⚙️ Find target Unity versions
|
||||||
|
id: setup
|
||||||
|
run: |
|
||||||
|
echo "==== Target Unity Versions ===="
|
||||||
|
LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||||
|
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||||
|
|
||||||
|
VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \
|
||||||
|
| jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'`
|
||||||
|
echo "unityVersions=${VERSIONS}" | tee $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: 🧪 Run tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
|
needs: setup
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 📥 Cache library
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: Library
|
||||||
|
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
Library-${{ matrix.unityVersion }}-
|
||||||
|
Library-
|
||||||
|
|
||||||
|
- name: 🛠️ Build Unity Project
|
||||||
|
uses: game-ci/unity-builder@v3
|
||||||
|
timeout-minutes: 30
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
with:
|
||||||
|
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||||
|
targetPlatform: StandaloneLinux64
|
||||||
|
allowDirtyBuild: true
|
||||||
|
customParameters: -nographics
|
||||||
|
|
||||||
|
- name: 🧪 Run tests
|
||||||
|
uses: game-ci/unity-test-runner@v3
|
||||||
|
timeout-minutes: 30
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
with:
|
||||||
|
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||||
|
# unityVersion: ${{ matrix.unityVersion }}
|
||||||
|
customParameters: -nographics
|
||||||
|
checkName: ${{ matrix.unityVersion }} Test Results
|
||||||
|
githubToken: ${{ github.token }}
|
||||||
|
coverageOptions: "dontClear;generateHtmlReport;generateBadgeReport;pathFilters:+**/Packages/src/**;assemblyFilters:+<packages>,-*.Editor,-*.Test"
|
|
@ -1,14 +1,11 @@
|
||||||
{
|
{
|
||||||
"branches": [
|
"branches": [
|
||||||
"+([0-9])?(.{+([0-9]),x}).x",
|
"release",
|
||||||
"master",
|
|
||||||
"main",
|
|
||||||
{
|
{
|
||||||
"name": "preview",
|
"name": "preview",
|
||||||
"prerelease": true
|
"prerelease": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tagFormat": "${version}",
|
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@semantic-release/commit-analyzer",
|
"@semantic-release/commit-analyzer",
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
|
|
Loading…
Reference in New Issue