diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 78c1b99..1275188 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -21,12 +21,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set Node.js 16 - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 16.x + cache: npm - name: Install dependencies run: npm ci @@ -44,7 +45,7 @@ jobs: id: diff # If index.js was different than expected, upload the expected version as an artifact - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ failure() && steps.diff.conclusion == 'failure' }} with: name: dist diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index 73504c0..fd70702 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest name: Check licenses steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: npm ci - name: Install licensed run: | diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index b585d56..aea26b3 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -21,7 +21,7 @@ jobs: dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4d377fb..34b7183 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -20,9 +20,9 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set Node.js 16 - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 16.x cache: npm @@ -42,7 +42,7 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} @@ -65,7 +65,7 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} @@ -98,7 +98,7 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} @@ -123,7 +123,7 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} @@ -147,7 +147,7 @@ jobs: operating-system: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear toolcache shell: pwsh run: __tests__/clear-toolcache.ps1 ${{ runner.os }} @@ -178,7 +178,7 @@ jobs: http_proxy: http://squid-proxy:3128 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear tool cache run: rm -rf "/usr/share/dotnet" - name: Install curl @@ -202,7 +202,7 @@ jobs: no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Clear tool cache run: rm -rf "/usr/share/dotnet" - name: Setup dotnet 3.1.201 diff --git a/README.md b/README.md index e642186..0caf702 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # setup-dotnet -

- GitHub Actions status -

+[![GitHub Actions Status](https://github.com/actions/setup-dotnet/workflows/Main%20workflow/badge.svg)](https://github.com/actions/setup-dotnet) This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by: @@ -23,8 +21,8 @@ See [action.yml](action.yml) Basic: ```yaml steps: -- uses: actions/checkout@v2 -- uses: actions/setup-dotnet@v1 +- uses: actions/checkout@v3 +- uses: actions/setup-dotnet@v2 with: dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel - run: dotnet build @@ -34,9 +32,9 @@ Multiple versions: ```yml steps: -- uses: actions/checkout@v2 +- uses: actions/checkout@v3 - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: | 3.1.x @@ -46,8 +44,8 @@ steps: Preview version: ```yml steps: -- uses: actions/checkout@v2 -- uses: actions/setup-dotnet@v1 +- uses: actions/checkout@v3 +- uses: actions/setup-dotnet@v2 with: dotnet-version: '6.0.x' include-prerelease: true @@ -64,9 +62,9 @@ jobs: dotnet: [ '2.1.x', '3.1.x', '5.0.x' ] name: Dotnet ${{ matrix.dotnet }} sample steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: ${{ matrix.dotnet }} - run: dotnet build @@ -79,13 +77,13 @@ jobs: runs-on: ubuntu-latest name: Dotnet Side by Side testing sample steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: '2.1.x' - name: Setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: dotnet-version: '3.1.x' - run: dotnet build @@ -95,9 +93,9 @@ jobs: Authentication for nuget feeds: ```yaml steps: -- uses: actions/checkout@v2 +- uses: actions/checkout@v3 # Authenticates packages to push to GPR -- uses: actions/setup-dotnet@v1 +- uses: actions/setup-dotnet@v2 with: dotnet-version: '3.1.x' # SDK Version to use. source-url: https://nuget.pkg.github.com//index.json @@ -110,7 +108,7 @@ steps: run: dotnet nuget push /bin/Release/*.nupkg # Authenticates packages to push to Azure Artifacts -- uses: actions/setup-dotnet@v1 +- uses: actions/setup-dotnet@v2 with: source-url: https://pkgs.dev.azure.com//_packaging//nuget/v3/index.json env: @@ -120,7 +118,7 @@ steps: # Authenticates packages to push to nuget.org. # It's only the way to push a package to nuget.org feed for macOS/Linux machines due to API key config store limitations. -- uses: actions/setup-dotnet@v1 +- uses: actions/setup-dotnet@v2 with: dotnet-version: 3.1.x - name: Publish the package to nuget.org @@ -145,7 +143,7 @@ build: DOTNET_NOLOGO: true steps: - uses: actions/checkout@main - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v2 with: dotnet-version: '3.1.x' # SDK Version to use. ``` diff --git a/docs/contributors.md b/docs/contributors.md index ae9dfe8..3c15695 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -26,9 +26,15 @@ With any contribution please take time to consider how this can be tested to mai ## Creating new version Details on versioning can be found here: https://github.com/actions/toolkit/blob/main/docs/action-versioning.md -Create a new release using the UI. Version format should be `v1.x.x`. Creating a new major version requires reaction from users and should be done only with breaking changes. -Once the new release is created, the v1 tag needs to be updated as well. +Create a new release using the UI. Version format should be `vX.Y.Z`. Creating a new major version requires reaction from users and should be done only with breaking changes. +Once the new release is created, the vX tag needs to be updated as well. ``` -git tag -fa v1 -m "Update v1 tag" -git push origin v1 --force +git tag -fa vX -m "Update vX tag" +git push origin vX --force ``` + +For example, if you're publishing v2: +``` +git tag -fa v2 -m "Update v2 tag" +git push origin v2 --force +``` \ No newline at end of file diff --git a/externals/install-dotnet.sh b/externals/install-dotnet.sh index f80355e..975737a 100755 --- a/externals/install-dotnet.sh +++ b/externals/install-dotnet.sh @@ -637,11 +637,13 @@ get_specific_product_version() { if machine_has "curl" then - specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1) - if [ $? = 0 ]; then + if ! specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1); then + continue + else echo "${specific_product_version//[$'\t\r\n']}" return 0 fi + elif machine_has "wget" then specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1) @@ -921,9 +923,15 @@ get_http_header_wget() { local remote_path="$1" local disable_feed_credential="$2" local wget_options="-q -S --spider --tries 5 " - # Store options that aren't supported on all wget implementations separately. - local wget_options_extra="--waitretry 2 --connect-timeout 15 " - local wget_result='' + + local wget_options_extra='' + + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi remote_path_with_credential="$remote_path" if [ "$disable_feed_credential" = false ]; then @@ -931,15 +939,8 @@ get_http_header_wget() { fi wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1 - wget_result=$? - if [[ $wget_result == 2 ]]; then - # Parsing of the command has failed. Exclude potentially unrecognized options and retry. - wget $wget_options "$remote_path_with_credential" 2>&1 - return $? - fi - - return $wget_result + return $? } # args: @@ -1030,10 +1031,17 @@ downloadwget() { # Append feed_credential as late as possible before calling wget to avoid logging feed_credential local remote_path_with_credential="${remote_path}${feed_credential}" local wget_options="--tries 20 " - # Store options that aren't supported on all wget implementations separately. - local wget_options_extra="--waitretry 2 --connect-timeout 15 " + + local wget_options_extra='' local wget_result='' + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi + if [ -z "$out_path" ]; then wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1 wget_result=$? @@ -1042,17 +1050,6 @@ downloadwget() { wget_result=$? fi - if [[ $wget_result == 2 ]]; then - # Parsing of the command has failed. Exclude potentially unrecognized options and retry. - if [ -z "$out_path" ]; then - wget -q $wget_options -O - "$remote_path_with_credential" 2>&1 - wget_result=$? - else - wget $wget_options -O "$out_path" "$remote_path_with_credential" 2>&1 - wget_result=$? - fi - fi - if [[ $wget_result != 0 ]]; then local disable_feed_credential=false local response=$(get_http_header_wget $remote_path $disable_feed_credential) @@ -1652,4 +1649,4 @@ fi say "Note that the script does not resolve dependencies during installation." say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." -say "Installation finished successfully." \ No newline at end of file +say "Installation finished successfully."