ci: automated release

This commit is contained in:
Théo LUDWIG 2025-04-28 14:08:46 +02:00
parent 354e15ae78
commit cc27037ea7
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -2,7 +2,7 @@ name: "ci"
on:
push:
branches: [develop]
branches: [develop, staging, main]
pull_request:
branches: [develop, staging, main]
@ -11,7 +11,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.2.2"
- uses: "wagoid/commitlint-github-action@v6.1.2"
- uses: "wagoid/commitlint-github-action@v6.2.1"
lint-editorconfig-checker:
runs-on: "ubuntu-latest"
@ -20,38 +20,78 @@ jobs:
- uses: "editorconfig-checker/action-editorconfig-checker@main"
- run: "editorconfig-checker"
# test:
# permissions:
# checks: "write"
# runs-on: "ubuntu-latest"
# steps:
# - uses: "actions/checkout@v4.2.2"
# with:
# lfs: true
# - uses: "actions/cache@v4.2.0"
# with:
# path: "Library"
# key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
# restore-keys: |
# "Library-"
# - uses: "game-ci/unity-test-runner@v4.3.1"
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
build:
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.0"
- 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/**') }}"
@ -66,7 +106,50 @@ jobs:
with:
targetPlatform: "StandaloneLinux64"
# - uses: "actions/upload-artifact@v4.4.3"
# with:
# name: "Build"
# path: "build"
- 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/**/*