From 39482c60ad08208fad7ef47559a62e2984dc5735 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 26 Jul 2022 00:07:23 +0900 Subject: [PATCH 1/3] feat: add IsPackable to each csproj --- sandbox/BlazorApp/BlazorApp.csproj | 1 + sandbox/ConsoleApp/ConsoleApp.csproj | 1 + sandbox/WpfApp/WpfApp.csproj | 1 + src/ObservableCollections/ObservableCollections.csproj | 1 + tools/PostBuildUtility/PostBuildUtility.csproj | 1 + 5 files changed, 5 insertions(+) diff --git a/sandbox/BlazorApp/BlazorApp.csproj b/sandbox/BlazorApp/BlazorApp.csproj index 74041af..173e196 100644 --- a/sandbox/BlazorApp/BlazorApp.csproj +++ b/sandbox/BlazorApp/BlazorApp.csproj @@ -3,6 +3,7 @@ net6.0 enable + false diff --git a/sandbox/ConsoleApp/ConsoleApp.csproj b/sandbox/ConsoleApp/ConsoleApp.csproj index 241e36b..9a761c6 100644 --- a/sandbox/ConsoleApp/ConsoleApp.csproj +++ b/sandbox/ConsoleApp/ConsoleApp.csproj @@ -5,6 +5,7 @@ net6.0 10.0 enable + false diff --git a/sandbox/WpfApp/WpfApp.csproj b/sandbox/WpfApp/WpfApp.csproj index d394da3..64c80a6 100644 --- a/sandbox/WpfApp/WpfApp.csproj +++ b/sandbox/WpfApp/WpfApp.csproj @@ -5,6 +5,7 @@ net6.0-windows enable true + false diff --git a/src/ObservableCollections/ObservableCollections.csproj b/src/ObservableCollections/ObservableCollections.csproj index 0ad6220..c5d263e 100644 --- a/src/ObservableCollections/ObservableCollections.csproj +++ b/src/ObservableCollections/ObservableCollections.csproj @@ -10,6 +10,7 @@ collection High performance observable collections and synchronized views, for WPF, Blazor, Unity. true + true diff --git a/tools/PostBuildUtility/PostBuildUtility.csproj b/tools/PostBuildUtility/PostBuildUtility.csproj index 94830bc..d96d8d5 100644 --- a/tools/PostBuildUtility/PostBuildUtility.csproj +++ b/tools/PostBuildUtility/PostBuildUtility.csproj @@ -4,6 +4,7 @@ Exe net6.0 enable + false From 81b95e31a33ffd18e691ac1576c04c523ddb1690 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 26 Jul 2022 00:07:31 +0900 Subject: [PATCH 2/3] chore: use Cysharp/Actions reusable workflow stale --- .github/workflows/stale.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..b480c3e --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,10 @@ +name: "Close stale issues" + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main From 5e5add8311819cf01c94d92653a601382a65b2e0 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 26 Jul 2022 00:07:38 +0900 Subject: [PATCH 3/3] chore: use Cysharp/Actions reusable action --- .github/workflows/build-debug.yml | 37 +++------ .github/workflows/build-release.yml | 122 ++++++---------------------- 2 files changed, 38 insertions(+), 121 deletions(-) diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index 2d5ebbc..55bf9f2 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -4,8 +4,6 @@ on: push: branches: - "master" - tags: - - "!*" # not a tag push pull_request: branches: - master @@ -13,20 +11,12 @@ on: jobs: build-dotnet: runs-on: ubuntu-latest - env: - DOTNET_SDK_VERSION: "6.0.x" - DOTNET_INCLUDE_PRERELEASE: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_XMLDOC_MODE: skip + timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNET_SDK_VERSION }} - include-prerelease: ${{ env.DOTNET_INCLUDE_PRERELEASE }} + - uses: actions/checkout@v3 + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main - run: dotnet build ObservableCollection.WithoutSandbox.slnf -c Debug - - run: dotnet test ObservableCollection.WithoutSandbox.slnf -c Debug --no-build < /dev/null + - run: dotnet test ObservableCollection.WithoutSandbox.slnf -c Debug --no-build build-unity: if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))" @@ -37,12 +27,13 @@ jobs: - unity: 2019.4.25f1 license: UNITY_LICENSE_2019 runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Execute scripts: Export Package # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export - name: Export unitypackage - uses: game-ci/unity-builder@v2.0-alpha-6 + uses: game-ci/unity-builder@v2 env: UNITY_LICENSE: ${{ secrets[matrix.license] }} with: @@ -52,18 +43,12 @@ jobs: buildMethod: PackageExporter.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: src/ObservableCollections.Unity + - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files + with: + directory: src/ObservableCollections.Unity # Store artifacts. - uses: actions/upload-artifact@v2 with: name: ObservableCollections.unitypackage-${{ matrix.unity }}.zip - path: ./src/ObservableCollections.Unity/*.unitypackage \ No newline at end of file + path: ./src/ObservableCollections.Unity/*.unitypackage diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 515a752..ff557e4 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -6,94 +6,38 @@ on: tag: description: "tag: git tag you want create. (sample 1.0.0)" required: true - dry_run: - description: "dry_run: true will never create relase/nuget." + dry-run: + description: "dry-run: true will never create relase/nuget." required: true - default: "false" + default: false + type: boolean env: GIT_TAG: ${{ github.event.inputs.tag }} - DRY_RUN: ${{ github.event.inputs.dry_run }} - DRY_RUN_BRANCH_PREFIX: "test_release" + DRY_RUN: ${{ github.event.inputs.dry-run }} jobs: update-packagejson: - runs-on: ubuntu-latest - env: - TARGET_FILE: ./src/ObservableCollections.Unity/Assets/Plugins/ObservableCollections/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: 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 + uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main + with: + file-path: ./src/ObservableCollections.Unity/Assets/Plugins/ObservableCollections/package.json + tag: ${{ github.event.inputs.tag }} + dry-run: ${{ fromJson(github.event.inputs.dry-run) }} build-dotnet: needs: [update-packagejson] runs-on: ubuntu-latest timeout-minutes: 10 - env: - DOTNET_SDK_VERSION: "6.0.x" - DOTNET_INCLUDE_PRERELEASE: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_XMLDOC_MODE: skip steps: - run: echo ${{ needs.update-packagejson.outputs.sha }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ needs.update-packagejson.outputs.sha }} - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNET_SDK_VERSION }} - include-prerelease: ${{ env.DOTNET_INCLUDE_PRERELEASE }} + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main # build and pack - run: dotnet build ObservableCollection.WithoutSandbox.slnf -c Release -p:Version=${{ env.GIT_TAG }} - run: dotnet test ObservableCollection.WithoutSandbox.slnf -c Release --no-build - - run: dotnet pack ./src/ObservableCollections/ObservableCollections.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish + - run: dotnet pack ObservableCollection.WithoutSandbox.slnf -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish # Store artifacts. - uses: actions/upload-artifact@v1 with: @@ -112,13 +56,13 @@ jobs: timeout-minutes: 15 steps: - run: echo ${{ needs.update-packagejson.outputs.sha }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ needs.update-packagejson.outputs.sha }} # Execute scripts: Export Package # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export - name: Export unitypackage - uses: game-ci/unity-builder@v2.0-alpha-6 + uses: game-ci/unity-builder@v2 env: UNITY_LICENSE: ${{ secrets[matrix.license] }} with: @@ -128,31 +72,23 @@ jobs: buildMethod: PackageExporter.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: src/ObservableCollections.Unity + - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files + with: + directory: src/ObservableCollections.Unity # Store artifacts. - uses: actions/upload-artifact@v2 with: - name: ObservableCollections.${{ env.GIT_TAG }}.unitypackage + name: ObservableCollections.${{ env.GIT_TAG }}.unitypackage.zip path: ./src/ObservableCollections.Unity/ObservableCollections.${{ env.GIT_TAG }}.unitypackage create-release: - if: github.event.inputs.dry_run == 'false' + if: github.event.inputs.dry-run == 'false' needs: [update-packagejson, build-dotnet, build-unity] runs-on: ubuntu-latest - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - NUGET_XMLDOC_MODE: skip + timeout-minutes: 10 steps: + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main # Create Releases - uses: actions/create-release@v1 id: create_release @@ -179,12 +115,8 @@ jobs: asset_content_type: application/octet-stream cleanup: - if: github.event.inputs.dry_run == 'true' - needs: [build-dotnet, build-unity] - runs-on: ubuntu-latest - steps: - - name: Delete branch - uses: dawidd6/action-delete-branch@v3 - with: - github_token: ${{ github.token }} - branches: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }} \ No newline at end of file + if: needs.update-packagejson.outputs.is-branch-created == 'true' + needs: [update-packagejson, build-unity] + uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main + with: + branch: ${{ needs.update-packagejson.outputs.branch-name }}