diff --git a/.gitattributes b/.gitattributes index 61b3ed3..2110857 100644 --- a/.gitattributes +++ b/.gitattributes @@ -70,6 +70,10 @@ *.pyo binary export-ignore *.pyd binary +### Linguist exclusions ############################################################################ + +test/* linguist-vendored + ### Exclude files from exporting ################################################################### .gitattributes export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1156b82..5de5f02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,12 @@ jobs: platform: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout - uses: actions/checkout@v3.1.0 + uses: actions/checkout@v3 + + - name: Remove all preinstalled .NET SDKs + shell: bash + run: | + "$GITHUB_WORKSPACE/test/cleanup.sh" - name: 'TEST: Set up specific .NET SDK version' id: setup-specific @@ -43,7 +48,7 @@ jobs: - name: Clean up shell: bash run: | - rm -rf "$DOTNET_ROOT" + "$GITHUB_WORKSPACE/test/cleanup.sh" - name: 'TEST: Set up multiple .NET SDK versions' id: setup-multiple @@ -68,7 +73,7 @@ jobs: - name: Clean up shell: bash run: | - rm -rf "$DOTNET_ROOT" + "$GITHUB_WORKSPACE/test/cleanup.sh" - name: 'Create "global.json"' shell: bash @@ -99,7 +104,7 @@ jobs: - name: Clean up shell: bash run: | - rm -rf "$DOTNET_ROOT" + "$GITHUB_WORKSPACE/test/cleanup.sh" - name: 'TEST: Read .NET SDK version from "global.json" and input' id: setup-global-json-extra @@ -123,4 +128,4 @@ jobs: - name: Clean up shell: bash run: | - rm -rf "$DOTNET_ROOT" + "$GITHUB_WORKSPACE/test/cleanup.sh" diff --git a/.github/workflows/update_semver.yml b/.github/workflows/update_semver.yml new file mode 100644 index 0000000..6cdbcea --- /dev/null +++ b/.github/workflows/update_semver.yml @@ -0,0 +1,14 @@ +name: Update Floating Version Tags + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + update-semver: + name: Update Tags + runs-on: ubuntu-latest + steps: + - name: Update Semver + uses: zyactions/update-semver@v1 diff --git a/README.md b/README.md index 842bd13..7d2ba0a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A GitHub Action to set up a specific version of the .NET SDK in a workflow run. ```yaml steps: - name: .NET Setup - uses: zyactions/dotnet-setup@master + uses: zyactions/dotnet-setup@v1 with: dotnet-version: '7.0.0' ``` @@ -36,7 +36,7 @@ steps: ```yaml steps: - name: .NET Setup - uses: zyactions/dotnet-setup@master + uses: zyactions/dotnet-setup@v1 with: dotnet-version: | 7.0.x @@ -48,7 +48,7 @@ steps: ```yaml steps: - name: .NET Setup - uses: zyactions/dotnet-setup@master + uses: zyactions/dotnet-setup@v1 with: global-json-file: ./global.json ``` @@ -119,7 +119,7 @@ Versions follow the [semantic versioning scheme][semver]. [dotnet-sdk]: https://github.com/dotnet/sdk [job-runs-on]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on [problem-matchers]: https://github.com/actions/runner/blob/main/docs/adrs/0276-problem-matchers.md -[semver]:https://semver.org +[semver]: https://semver.org [shield-license-mit]: https://img.shields.io/badge/License-MIT-blue.svg [shield-ci]: https://github.com/zyactions/dotnet-setup/actions/workflows/ci.yml/badge.svg [shield-platform-ubuntu]: https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\&logoColor=white diff --git a/action.yml b/action.yml index effd439..091d1df 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ runs: steps: - name: Setup .NET id: setup - uses: actions/setup-dotnet@v3.0.3 + uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ inputs.dotnet-version }} dotnet-quality: ${{ inputs.dotnet-quality }} diff --git a/test/cleanup.sh b/test/cleanup.sh new file mode 100755 index 0000000..1e46d5c --- /dev/null +++ b/test/cleanup.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +function try_rename () { + temp=$(mktemp --dry-run XXXXXXXX) + { mv "$1" "$1_$temp" || :; } > /dev/null 2>&1 +} + +if [[ -n "$DOTNET_ROOT" ]]; then + try_rename "$DOTNET_ROOT" +fi + +if [[ "$RUNNER_OS" == "Windows" ]]; then + if [[ -n "$PROGRAMFILES" ]]; then + try_rename "$PROGRAMFILES\dotnet" + fi + + if [[ -n "$LOCALAPPDATA" ]]; then + try_rename "$LOCALAPPDATA\Microsoft\dotnet" + fi +else + try_rename "~/.dotnet" + try_rename "/usr/share/dotnet" + try_rename "/usr/local/share/dotnet" +fi