Skip to content

Commit

Permalink
Update CI/CD to the latest instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstenko committed Sep 29, 2024
1 parent e62d37d commit b769e2b
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 112 deletions.
Empty file removed .codacy.yml
Empty file.
18 changes: 0 additions & 18 deletions .github/workflows/activation.yml

This file was deleted.

133 changes: 42 additions & 91 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,119 +1,70 @@
name: Actions 😎

on: [push, pull_request]
# only run when pushed to master or main branches
on:
push:
branches:
- master
- main

jobs:
buildWebGL:
name: Build my project ✨
build:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform: # uncomment some of the following lines to build for specific platform
# - StandaloneOSX # Build a macOS standalone (Intel 64-bit).
# - StandaloneWindows # Build a Windows standalone.
# - StandaloneWindows64 # Build a Windows 64-bit standalone.
# - StandaloneLinux64 # Build a Linux 64-bit standalone.
# - iOS # Build an iOS player.
# - Android # Build an Android .apk standalone app.
- WebGL # WebGL.
steps:
# Checkout
- name: Checkout repository 🛒
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true

# # Git LFS
# - name: Create LFS file list
# run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
#
# - name: Restore LFS cache
# uses: actions/cache@v2
# id: lfs-cache
# with:
# path: .git/lfs
# key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
#
# - name: Git LFS Pull
# run: |
# git lfs pull
# git add .
# git reset --hard
fetch-depth: 0
lfs: 'true'

# Cache
- name: Cache 💾
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-

- if: matrix.targetPlatform == 'Android'
uses: jlumbroso/[email protected]

# Build
- name: Build project 🔨
uses: game-ci/unity-builder@v2
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
versioning: Semantic
targetPlatform: ${{ matrix.targetPlatform }}
# customImage: 'unityci/editor:2020.1.14f1-base-0'

# Deploy
- name: Deploy 🚀
if: matrix.targetPlatform == 'WebGL' # Deploy webgl build only for WebGL
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/WebGL/WebGL # The folder the action should deploy.
single-commit: true

# - name: GitHub Pages
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # You may pin to the exact commit or the version.
# # uses: crazy-max/ghaction-github-pages@a117e4aa1fb4854d021546d2abdfac95be568a3a
# uses: crazy-max/[email protected]
# with:
# # Git domain (default github.com)
# #domain: # optional, default is github.com
# # GitHub repository where assets will be deployed (default $GITHUB_REPOSITORY)
# #repo: # optional
# # Git branch where assets will be deployed
# #target_branch: # optional, default is gh-pages
# # Create incremental commit instead of doing push force
# #keep_history: # optional, default is false
# # Allow an empty commit to be created
# #allow_empty_commit: # optional, default is true
# # Build directory to deploy
# build_dir: bin-emscripten/bin/
# # Whether to treat build_dir as an absolute path
# #absolute_build_dir: # optional, default is false
# # If enabled, the content of symbolic links will be copied
# #follow_symlinks: # optional, default is false
# # The committer name and email address
# #committer: # optional
# # The author name and email address
# #author: # optional
# # Commit message
# #commit_message: # optional
# # Write the given domain name to the CNAME file
# #fqdn: # optional
# # Allow Jekyll to build your site
# #jekyll: # optional, default is true
# # If enabled, nothing will be pushed
# #dry_run: # optional, default is false
# # Enable verbose output
# #verbose: # optional, default is false
# Archive artifacts
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}

# # Output
# - uses: actions/upload-artifact@v2
# with:
# name: Build
# path: build

# deployPages:
# needs: buildWebGL
# name: Deploy to Github Pages 🚀
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - uses: actions/download-artifact@v2
# with:
# name: build-WebGL
# path: build
#
# - name: Deploy 🚀
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: build/WebGL

29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Unity Boilerplate test
# Unity WebGL CI/CD with GitHub Actions

WebGL published here https://infinibrains.github.io/UnityBoilerplate/
WebGL published here (EDIT IT!) https://YOUR_GH_USERNAME.github.io/YOUR_REPO_NAME/

[![Build 😎](https://github.com/InfiniBrains/UnityBoilerplate/actions/workflows/main.yml/badge.svg)](https://github.com/InfiniBrains/MedicalImageViewer/actions/workflows/main.yml)
# Setup Steps:

- [ ] I understand FERPA laws. If I make the repository public, I will remove any student information, or I am waiving the requirement to remove student information. Otherwise, I am making the repository private;
- [ ] I have forked the repository to my own GitHub account;
- [ ] I have edited the README.md file to include my own information on the url for the web build;
- [ ] I have followed the instructions to activate my personal licence here: https://game.ci/docs/github/activation/ ;
- [ ] If I chose to make the repository private, I will follow this guide to add the instructor as a collaborator. https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository and set up the keys here https://game.ci/docs/github/builder/#private-github-repositories
- [ ] I have added the `UNITY_LICENSE` secret to my repository with the Unity license key;
- [ ] I have added the `UNITY_USERNAME` secret to my repository with the Unity username;
- [ ] I have added the `UNITY_PASSWORD` secret to my repository with the Unity password;
- [ ] I changed the `Settings` > `Actions` > `General` > `Workflow Permissions` to `Read and write permissions for actions`;
- [ ] I cloned the repository to my local machine and opened the project in Unity and made changes to the project;
- [ ] I have committed and pushed the changes to the `main` or `master` branch of the repository;
- [ ] I understand that every time I push to the `main` or `master` branch, the project will be built and deployed to the `gh-pages` branch;
- [ ] I saw the GitHub Actions build the project;
- [ ] I changed the `Settings` > `Pages` > `Source` to `gh-pages` branch;
- [ ] I saw the GitHub Actions deploy the project to the `gh-pages` branch;
- [ ] I can open the web build in the browser at the url: https://YOUR_GH_USERNAME.github.io/YOUR_REPO_NAME/
- [ ] I have read the https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow and understand the Gitflow workflow;
- [ ] I understand that I should create a new branch for each feature or fix I am working on;
- [ ] I have read the `.github/workflows/main.yml` file and understand how the GitHub Actions are working;
- [ ] If I want to customize my build, I will read the https://game.ci/docs/github/builder/ documentation;
- [ ] I have read Semantic Versioning https://semver.org/ and understand how to version my project;
- [ ] I have read how Semantic versioning would work for unity here https://game.ci/docs/github/builder/#versioning
- [ ] I have set my first git tag to `0.1.0` to my latest commit on the `main` or `master` branch;

0 comments on commit b769e2b

Please sign in to comment.