Merge pull request #381 from Cysharp/feature/actions
feat: use Cysharp/Actions reusable workflows/actionsmaster
commit
a94e8cceac
|
@ -4,8 +4,6 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
tags:
|
|
||||||
- "!*" # not a tag push
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
|
@ -13,13 +11,16 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build-dotnet:
|
build-dotnet:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
timeout-minutes: 10
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
||||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
|
||||||
NUGET_XMLDOC_MODE: skip
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: dotnet test -c Debug ./src/UniTask.NetCoreTests/UniTask.NetCoreTests.csproj
|
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
3.1.x
|
||||||
|
6.0.x
|
||||||
|
- run: dotnet build -c Debug
|
||||||
|
- run: dotnet test -c Debug
|
||||||
|
|
||||||
build-unity:
|
build-unity:
|
||||||
if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
||||||
|
@ -34,12 +35,13 @@ jobs:
|
||||||
- unity: 2020.1.12f1
|
- unity: 2020.1.12f1
|
||||||
license: UNITY_LICENSE_2020
|
license: UNITY_LICENSE_2020
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
# Execute scripts: RuntimeUnitTestToolkit
|
# Execute scripts: RuntimeUnitTestToolkit
|
||||||
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
||||||
- name: Build UnitTest(Linux64, mono)
|
- name: Build UnitTest(Linux64, mono)
|
||||||
uses: game-ci/unity-builder@v2.0-alpha-6
|
uses: game-ci/unity-builder@v2
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
with:
|
with:
|
||||||
|
@ -55,7 +57,7 @@ jobs:
|
||||||
# Execute scripts: Export Package
|
# Execute scripts: Export Package
|
||||||
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
- name: Export unitypackage
|
- name: Export unitypackage
|
||||||
uses: game-ci/unity-builder@v2.0-alpha-6
|
uses: game-ci/unity-builder@v2
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
with:
|
with:
|
||||||
|
@ -65,15 +67,9 @@ jobs:
|
||||||
buildMethod: PackageExporter.Export
|
buildMethod: PackageExporter.Export
|
||||||
versioning: None
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
|
||||||
run: |
|
with:
|
||||||
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
|
directory: src/UniTask
|
||||||
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: src/UniTask
|
|
||||||
|
|
||||||
# Store artifacts.
|
# Store artifacts.
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
|
|
|
@ -9,6 +9,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
run-docfx:
|
run-docfx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
@ -6,90 +6,44 @@ on:
|
||||||
tag:
|
tag:
|
||||||
description: "tag: git tag you want create. (sample 1.0.0)"
|
description: "tag: git tag you want create. (sample 1.0.0)"
|
||||||
required: true
|
required: true
|
||||||
dry_run:
|
dry-run:
|
||||||
description: "dry_run: true will never create relase/nuget."
|
description: "dry-run: true will never create relase/nuget."
|
||||||
required: true
|
required: true
|
||||||
default: "false"
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GIT_TAG: ${{ github.event.inputs.tag }}
|
GIT_TAG: ${{ github.event.inputs.tag }}
|
||||||
DRY_RUN: ${{ github.event.inputs.dry_run }}
|
DRY_RUN: ${{ github.event.inputs.dry-run }}
|
||||||
DRY_RUN_BRANCH_PREFIX: "test_release"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-packagejson:
|
update-packagejson:
|
||||||
runs-on: ubuntu-latest
|
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
|
||||||
env:
|
with:
|
||||||
TARGET_FILE: ./src/UniTask/Assets/Plugins/UniTask/package.json
|
file-path: ./src/UniTask/Assets/Plugins/UniTask/package.json
|
||||||
outputs:
|
tag: ${{ github.event.inputs.tag }}
|
||||||
sha: ${{ steps.commit.outputs.sha }}
|
dry-run: ${{ fromJson(github.event.inputs.dry-run) }}
|
||||||
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: env.DRY_RUN == 'false' && steps.check_update.outputs.changed == '1'
|
|
||||||
uses: ad-m/github-push-action@master
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
branch: ${{ github.ref }}
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
- name: Push changes (dry_run)
|
|
||||||
if: env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1'
|
|
||||||
uses: ad-m/github-push-action@master
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
|
|
||||||
tags: false
|
|
||||||
|
|
||||||
build-dotnet:
|
build-dotnet:
|
||||||
needs: [update-packagejson]
|
needs: [update-packagejson]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
env:
|
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
||||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
|
||||||
NUGET_XMLDOC_MODE: skip
|
|
||||||
steps:
|
steps:
|
||||||
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
3.1.x
|
||||||
|
6.0.x
|
||||||
# build and pack
|
# build and pack
|
||||||
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
|
- run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }}
|
||||||
- run: dotnet test -c Release --no-build
|
- run: dotnet test -c Release --no-build
|
||||||
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
|
- run: dotnet pack ./src/UniTask.NetCore/UniTask.NetCore.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish
|
||||||
# Store artifacts.
|
# Store artifacts.
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: nuget
|
name: nuget
|
||||||
path: ./publish/
|
path: ./publish/
|
||||||
|
@ -112,7 +66,7 @@ jobs:
|
||||||
# Execute scripts: Export Package
|
# Execute scripts: Export Package
|
||||||
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
- name: Export unitypackage
|
- name: Export unitypackage
|
||||||
uses: game-ci/unity-builder@v2.0-alpha-6
|
uses: game-ci/unity-builder@v2
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
with:
|
with:
|
||||||
|
@ -122,15 +76,9 @@ jobs:
|
||||||
buildMethod: PackageExporter.Export
|
buildMethod: PackageExporter.Export
|
||||||
versioning: None
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
|
||||||
run: |
|
with:
|
||||||
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
|
directory: src/UniTask
|
||||||
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: src/UniTask
|
|
||||||
|
|
||||||
# Store artifacts.
|
# Store artifacts.
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
|
@ -139,14 +87,12 @@ jobs:
|
||||||
path: ./src/UniTask/UniTask.${{ env.GIT_TAG }}.unitypackage
|
path: ./src/UniTask/UniTask.${{ env.GIT_TAG }}.unitypackage
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
if: github.event.inputs.dry_run == 'false'
|
if: github.event.inputs.dry-run == 'false'
|
||||||
needs: [update-packagejson, build-dotnet, build-unity]
|
needs: [update-packagejson, build-dotnet, build-unity]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
timeout-minutes: 10
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
||||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
|
||||||
NUGET_XMLDOC_MODE: skip
|
|
||||||
steps:
|
steps:
|
||||||
|
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||||
# Create Releases
|
# Create Releases
|
||||||
- uses: actions/create-release@v1
|
- uses: actions/create-release@v1
|
||||||
id: create_release
|
id: create_release
|
||||||
|
@ -173,12 +119,8 @@ jobs:
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if: github.event.inputs.dry_run == 'true'
|
if: needs.update-packagejson.outputs.is-branch-created == 'true'
|
||||||
needs: [build-dotnet, build-unity]
|
needs: [update-packagejson, build-dotnet, build-unity]
|
||||||
runs-on: ubuntu-latest
|
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
|
||||||
steps:
|
with:
|
||||||
- name: Delete branch
|
branch: ${{ needs.update-packagejson.outputs.branch-name }}
|
||||||
uses: dawidd6/action-delete-branch@v3
|
|
||||||
with:
|
|
||||||
github_token: ${{ github.token }}
|
|
||||||
branches: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }}
|
|
||||||
|
|
|
@ -1,24 +1,10 @@
|
||||||
name: "Close stale issues"
|
name: "Close stale issues"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v3
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# enable issue
|
|
||||||
stale-issue-message: "This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days."
|
|
||||||
stale-issue-label: "stale"
|
|
||||||
# enable pr
|
|
||||||
stale-pr-message: "This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days."
|
|
||||||
stale-pr-label: "stale"
|
|
||||||
days-before-stale: 90
|
|
||||||
days-before-close: 7
|
|
||||||
exempt-issue-labels: "wip"
|
|
||||||
exempt-pr-labels: "wip"
|
|
||||||
remove-stale-when-updated: true
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<PackageIcon>Icon.png</PackageIcon>
|
<PackageIcon>Icon.png</PackageIcon>
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>opensource.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>opensource.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<RootNamespace>NetCoreSandbox</RootNamespace>
|
<RootNamespace>NetCoreSandbox</RootNamespace>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue