Skip to content

Commit

Permalink
feat: create github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristyanS committed Mar 3, 2024
1 parent e10521f commit d61d55e
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/activation-unity-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Acquire activation file
on: [workflow_dispatch]
jobs:
activation:
name: Request manual activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- name: Request manual activation file
id: getManualLicenseFile
uses: game-ci/unity-request-activation-file@v2
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact
uses: actions/upload-artifact@v1
with:
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
102 changes: 102 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build
on:
push:
branches:
- main
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
jobs:

build:
name: Build my project ✨
runs-on: ubuntu-latest
steps:
- name: Checkout repository ☑️
uses: actions/checkout@v2
with:
lfs: true

- name: Active Cache 📁
uses: actions/[email protected]
with:
path: Library
key: Library

- name: Unity - Builder 🔨
uses: game-ci/[email protected]
with:
unityVersion: ${{ vars.UNITY_VERSION }}
targetPlatform: StandaloneWindows64
kubeVolumeSize: 8Gi

- name: Upload Build ⬆️
uses: actions/upload-artifact@v1
with:
name: Build
path: build

- name: Unity - Tests 🧪
uses: game-ci/[email protected]
with:
unityVersion: ${{ vars.UNITY_VERSION }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: SonarCloud - Scan 🔍
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION_KEY }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
release-project:
name: Create Release 📦
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository ☑️
uses: actions/checkout@v2

- name: Create GitHub Release 🐱📦
uses: actions/setup-node@v1
id: create-new-release
with:
node-version: "12.x"
- run: npm ci
- run: npm run build --if-present
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Download site ⬇️
uses: actions/download-artifact@v2
id: download
with:
name: Build
path: build

- name: Archive Build content 🗄️
uses: thedoctor0/zip-release@master
with:
filename: Build.zip
path: build

- name: Gets latest created release info ℹ️
id: latest_release_info
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload asset to Github Release ⬆️
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{steps.latest_release_info.outputs.upload_url}}
asset_name: Build-v${{github.run_number}}.zip
asset_path: ./Build.zip
asset_content_type: application/zip

33 changes: 33 additions & 0 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pull Request Check
on: [ pull_request ]
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
jobs:

build:
name: Pull Request Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository ☑️
uses: actions/checkout@v2
with:
lfs: true

- name: Unit Tests 🧪
uses: game-ci/[email protected]
with:
unityVersion: ${{ vars.UNITY_VERSION }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: SonarCloud Scan 🔍
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION_KEY }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}

0 comments on commit d61d55e

Please sign in to comment.