Release Unity Package #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Unity Package | |
on: | |
workflow_run: | |
workflows: | |
- "Update package.json" | |
types: | |
- completed | |
env: | |
FILE_NAME: "IDReference" | |
BUILD_METHOD: "IDReferenceExport.ExportGithub" | |
jobs: | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false | |
steps: | |
# Checkout | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
# Cache | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: Library | |
key: Library-Release | |
restore-keys: Library- | |
# Build | |
- name: Build package | |
id: build | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
buildName: ${{ env.FILE_NAME }}.unitypackage | |
targetPlatform: StandaloneLinux64 | |
buildMethod: ${{ env.BUILD_METHOD }} | |
versioning: None | |
# Check .meta | |
- 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: Assets | |
# Versioning | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Create Release | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
release_name: ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
draft: false | |
prerelease: false | |
# Upload Assets | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/${{ env.FILE_NAME }}.unitypackage | |
asset_name: ${{ env.FILE_NAME }}_${{ steps.tag_version.outputs.new_tag }}.unitypackage | |
asset_content_type: application/zip |