Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mackysoft committed Oct 21, 2023
1 parent f4d3aaa commit 9959900
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Bug Report
description: File a bug report
title: "[BUG] "
labels: ["bug"]
assignees:
- mackysoft
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: input
id: version
attributes:
label: XPool Version
description: What version of XPool were you running?
placeholder: ex. 0.1.0
validations:
required: true
- type: input
id: unity-version
attributes:
label: Unity Version
description: What version of Unity were you running?
placeholder: ex. 2020.3.24f1
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Scripting API
url: https://mackysoft.github.io/XPool/api/MackySoft.XPool.html
about: You may find the feature you are looking for.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Feature Request
description: Suggest an idea for this library
title: "[FEATURE] "
labels: ["enhancement"]
assignees:
- mackysoft
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: textarea
id: feature-description
attributes:
label: Feature destription
validations:
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/improvement-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Improvement Request
description: Suggest an improve for this library
title: "[IMPROVE] "
labels: ["enhancement"]
assignees:
- mackysoft
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this improvement request!
- type: textarea
id: improvement-description
attributes:
label: Improvement destription
validations:
required: true
55 changes: 55 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Documentation

on:
push:
branches:
- main

jobs:
# Build the documentation
build:
runs-on: windows-latest # Required by DocFX
steps:
- name: Checkout
uses: actions/checkout@v2
# with:
# submodules: true

- name: Install DocFX
run: choco install -y docfx

- name: Use README.md as index.md
run: cp README.md Documentation/index.md

- name: Build
run: docfx Documentation/docfx.json

# Upload the generated documentation
- name: Upload site artifact
uses: actions/upload-artifact@v1
with:
name: _site
path: _site # Must equals the 'build.dest' value on your docfx.json

# Deploy the generated documentation to the gh-pages branch
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# with:
# submodules: true

# Download the generated documentation
- name: Download site artifact
uses: actions/download-artifact@v1
with:
name: _site

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: _site
130 changes: 130 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Release

on:
workflow_dispatch:
inputs:
tag:
description: "tag: git tag you want create. (sample 1.0.0)"
required: true

env:
GIT_TAG: ${{ github.event.inputs.tag }}

jobs:
update-packagejson:
runs-on: ubuntu-latest
env:
TARGET_FILE: ./Assets/MackySoft/MackySoft.XPool/package.json
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@v2
- name: Output package.json (Before)
run: cat ${{ env.TARGET_FILE}}

- name: Update package.json to version ${{ env.GIT_TAG }}
run: sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }}

- name: Check update
id: check_update
run: |
cat ${{ env.TARGET_FILE}}
git diff --exit-code || echo "::set-output name=changed::1"
- name: Commit files
id: commit
if: steps.check_update.outputs.changed == '1'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a
echo "::set-output name=sha::$(git rev-parse HEAD)"
- name: Check sha
run: echo "SHA ${SHA}"
env:
SHA: ${{ steps.commit.outputs.sha }}

- name: Create Tag
if: steps.check_update.outputs.changed == '1'
run: git tag ${{ env.GIT_TAG }}

- name: Push changes
if: steps.check_update.outputs.changed == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true

build:
needs: [update-packagejson]
strategy:
matrix:
unity: ["2020.3.24f1"]
include:
- unityVersion: 2020.3.24f1
license: UNITY_LICENSE_2020
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v2
with:
ref: ${{ needs.update-packagejson.outputs.sha }}

- name: Export unitypackage
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets[matrix.license] }}
with:
projectPath: .
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: StandaloneLinux64
buildMethod: MackySoft.PackageTools.Editor.UnityPackageExporter.Export
versioning: None

- name: check all .meta is commited
run: |
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
echo "Detected .meta file generated. Do you forgot commit a .meta file?"
exit 1
else
echo "Great, all .meta files are commited."
fi
working-directory: .

# Store artifacts.
- uses: actions/upload-artifact@v2
with:
name: XPool.unitypackage
path: ./Build/XPool.unitypackage

create-release:
needs: [update-packagejson, build]
runs-on: ubuntu-latest
steps:
# Create Releases
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GIT_TAG }}
release_name: ${{ env.GIT_TAG }}
commitish: ${{ needs.update-packagejson.outputs.sha }}
draft: true
prerelease: false

# Download(All) Artifacts to current directory
- uses: actions/download-artifact@v2

# Upload to Releases(unitypackage)
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./XPool.unitypackage/XPool.unitypackage
asset_name: XPool.unitypackage
asset_content_type: application/octet-stream

0 comments on commit 9959900

Please sign in to comment.