diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c9e0840 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,38 @@ +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +# Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022#how-to-customize-the-spell-checker) +spelling_exclusion_path = ./exclusion.dic + +[*.cs] +indent_size = 4 +charset = utf-8-bom +end_of_line = unset + +# Solution files +[*.{sln,slnx}] +end_of_line = unset + +# MSBuild project files +[*.{csproj,props,targets}] +end_of_line = unset + +# Xml config files +[*.{ruleset,config,nuspec,resx,runsettings,DotSettings}] +end_of_line = unset + +# C# code style settings +[*.{cs}] +dotnet_diagnostic.IDE0044.severity = none # IDE0044: Make field readonly + +# https://stackoverflow.com/questions/79195382/how-to-disable-fading-unused-methods-in-visual-studio-2022-17-12-0 +dotnet_diagnostic.IDE0051.severity = none # IDE0051: Remove unused private member +dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 0a2ea8e..abfe20a 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -12,19 +12,33 @@ on: default: false type: boolean +concurrency: + group: release + cancel-in-progress: false + jobs: + validate-release: + permissions: + contents: read + uses: Cysharp/Actions/.github/workflows/validate-release.yaml@main + with: + tag: ${{ inputs.tag }} + update-packagejson: + needs: [validate-release] permissions: actions: read contents: write uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main with: file-path: ./src/CsprojModifier/Assets/CsprojModifier/package.json - tag: ${{ inputs.tag }} + tag: ${{ needs.validate-release.outputs.tag }} dry-run: ${{ inputs.dry-run }} + use-bot-token: true + secrets: inherit build-unity: - needs: [update-packagejson] + needs: [validate-release, update-packagejson] strategy: matrix: unity: ["6000.0.23f1"] @@ -57,7 +71,7 @@ jobs: UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} - UNITY_PACKAGE_VERSION: ${{ inputs.tag }} + UNITY_PACKAGE_VERSION: ${{ needs.validate-release.outputs.version }} with: projectPath: src/CsprojModifier unityVersion: ${{ matrix.unity }} @@ -71,28 +85,27 @@ jobs: # Store artifacts. - uses: Cysharp/Actions/.github/actions/upload-artifact@main with: - name: CsprojModifier.${{ inputs.tag }}.unitypackage - path: ./src/CsprojModifier/CsprojModifier.${{ inputs.tag }}.unitypackage + name: CsprojModifier.${{ needs.validate-release.outputs.tag }}.unitypackage + path: ./src/CsprojModifier/CsprojModifier.${{ needs.validate-release.outputs.tag }}.unitypackage retention-days: 1 # release create-release: - needs: [update-packagejson, build-unity] + needs: [validate-release, update-packagejson, build-unity] permissions: contents: write uses: Cysharp/Actions/.github/workflows/create-release.yaml@main with: commit-id: ${{ needs.update-packagejson.outputs.sha }} dry-run: ${{ inputs.dry-run }} - tag: ${{ inputs.tag }} - nuget-push: false + tag: ${{ needs.validate-release.outputs.tag }} release-upload: true - release-asset-path: ./CsprojModifier.${{ inputs.tag }}.unitypackage/CsprojModifier.${{ inputs.tag }}.unitypackage + release-asset-path: ./CsprojModifier.${{ needs.validate-release.outputs.tag }}.unitypackage/CsprojModifier.${{ needs.validate-release.outputs.tag }}.unitypackage secrets: inherit cleanup: - if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} - needs: [update-packagejson, build-unity] + if: ${{ always() && needs.update-packagejson.outputs.is-branch-created == 'true' }} + needs: [update-packagejson, create-release] permissions: actions: write uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main