Skip to content

Commit

Permalink
Use major version tags in README and workflows (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd authored Dec 20, 2022
1 parent f02ad41 commit 8f4b644
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
*.pyo binary export-ignore
*.pyd binary

### Linguist exclusions ############################################################################

test/* linguist-vendored

### Exclude files from exporting ###################################################################

.gitattributes export-ignore
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/[email protected]
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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -123,4 +128,4 @@ jobs:
- name: Clean up
shell: bash
run: |
rm -rf "$DOTNET_ROOT"
"$GITHUB_WORKSPACE/test/cleanup.sh"
14 changes: 14 additions & 0 deletions .github/workflows/update_semver.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```
Expand All @@ -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
Expand All @@ -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
```
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
24 changes: 24 additions & 0 deletions test/cleanup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8f4b644

Please sign in to comment.