160 lines
4.4 KiB
YAML

name: "ci"
on:
push:
branches: [develop, staging, main]
pull_request:
branches: [develop, staging, main]
permissions:
contents: write
pull-requests: write
jobs:
lint-commit:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.2.2"
- uses: "wagoid/commitlint-github-action@v6.2.1"
lint-editorconfig-checker:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.2.2"
- uses: "editorconfig-checker/action-editorconfig-checker@main"
- run: "editorconfig-checker"
build-windows:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
restore-keys: |
"Library-"
- uses: "game-ci/unity-builder@v4.3.0"
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: "StandaloneWindows64"
- name: Upload Windows Build Artifact
id: upload
uses: actions/upload-artifact@v4.4.3
with:
name: build-windows
path: build/
build-macos:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
restore-keys: |
"Library-"
- uses: "game-ci/unity-builder@v4.3.0"
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: "StandaloneOSX"
- name: Upload macOS Build Artifact
id: upload
uses: actions/upload-artifact@v4.4.3
with:
name: build-macos
path: build/
build-linux:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
restore-keys: |
"Library-"
- uses: "game-ci/unity-builder@v4.3.0"
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: "StandaloneLinux64"
- name: Upload Linux Build Artifact
id: upload
uses: actions/upload-artifact@v4.6.2
with:
name: build-linux
path: build/
create-release:
needs: [build-windows, build-macos, build-linux]
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Download Windows Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-windows
path: build/windows
- name: Download macOS Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-macos
path: build/macos
- name: Download Linux Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-linux
path: build/linux
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2.2.2
with:
tag_name: v${{ github.run_number }}
name: |
${{ github.ref == 'refs/heads/main' && 'Production Release' || 'Pre-release' }} v${{ github.run_number }}
body: |
🎮 Automatic ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pre-release' }} build
Branch: `${{ github.ref_name }}`
Commit: `${{ github.sha }}`
prerelease: ${{ github.ref != 'refs/heads/main' }}
files: |
build/windows/**/*
build/macos/**/*
build/linux/**/*