Skip to content

Commit

Permalink
fix(actions): improve actions (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmaxi-me authored Mar 15, 2021
1 parent de65b06 commit 2e608c8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# From https://github.com/alexkaratarakis/gitattributes/blob/master/Unity.gitattributes
# from github alexkaratarakis/gitattributes

# Unity
*.cginc text
Expand Down
39 changes: 24 additions & 15 deletions .github/workflows/unity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ jobs:
with:
lfs: true
submodules: true
# fetch-depth: 0 # game-ci/unity-builder optionally needs the whole history, for auto versioning
fetch-depth: 0 # Give dorny/paths-filter enough history to check changes, otherwise it will pull by itself.

- name: Setup Action Variables
id: vars
run: |
echo "::set-output name=version::$(git describe --tags || echo "v0.0")"
- name: Paths Changes Filter
uses: dorny/[email protected]
id: changes
with:
initial-fetch-depth: 2
initial-fetch-depth: 0
base: '${{ github.ref }}'
filters: |
path:
Expand All @@ -49,9 +54,10 @@ jobs:
with:
path: ${{ matrix.path }}/Library
key: ${{ matrix.target }}-${{ matrix.path }}-${{ matrix.version }}
restore-keys: |
${{ matrix.target }}-${{ matrix.path }}-
${{ matrix.target }}-
# restore-keys: |
# ${{ matrix.target }}-${{ matrix.path }}-
# ${{ matrix.target }}-
if: (github.event_name == 'release' && github.event.action == 'published') || steps.changes.outputs.path == 'true' || steps.changes.outputs.workflow == 'true'

- name: Unity Builder
uses: game-ci/[email protected]
Expand All @@ -62,24 +68,27 @@ jobs:
projectPath: ${{ matrix.path }}
unityVersion: ${{ matrix.version }}
targetPlatform: ${{ matrix.target }}
versioning: Custom
version: ${{ steps.vars.outputs.version }}
# allowDirtyBuild: true # fixes CRLF/LF conversion errors, but dirty
if: (github.event_name == 'release' && github.event.action == 'published') || steps.changes.outputs.path == 'true' || steps.changes.outputs.workflow == 'true'

- name: Zip build directory
run: |
cd build/
sudo zip -r "${{ matrix.path }}.${{ matrix.target }}.zip" "${{ matrix.target }}"
sudo mv "${{ matrix.path }}.${{ matrix.target }}.zip" ../
if: (github.event_name == 'release' && github.event.action == 'published') || steps.changes.outputs.path == 'true' || steps.changes.outputs.workflow == 'true'

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.path }}.${{ matrix.target }}
path: build/${{ matrix.target }}
retention-days: 28
name: "${{ matrix.path }}.${{ matrix.target }}.zip"
path: "${{ matrix.path }}.${{ matrix.target }}.zip"
retention-days: 14
if-no-files-found: error
if: (github.event_name == 'release' && github.event.action == 'published') || steps.changes.outputs.path == 'true' || steps.changes.outputs.workflow == 'true'

- name: Zip for Release
run: |
cd build/
zip -r "${{ matrix.path }}.${{ matrix.target }}.zip" "${{ matrix.target }}"
if: github.event_name == 'release' && github.event.action == 'published'

- name: Upload Artifact to Release
uses: actions/[email protected]
env:
Expand All @@ -89,4 +98,4 @@ jobs:
asset_name: ${{ matrix.path }}.${{ matrix.target }}.zip
asset_path: ${{ matrix.path }}.${{ matrix.target }}.zip
asset_content_type: application/zip
if: github.event_name == 'release' && github.event.action == 'published'
if: github.event_name == 'release' && github.event.action == 'published'

0 comments on commit 2e608c8

Please sign in to comment.