From dfce2ce5eca13a38816c18fe6cb624022c813509 Mon Sep 17 00:00:00 2001 From: get-me-power Date: Wed, 31 Jan 2024 23:32:18 +0900 Subject: [PATCH 1/4] chore: update publish command update: publish.yml --- .github/workflows/publish.yml | 45 +++++++++++++++++++++++++++++++++++ publish | 3 +-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..1f46e40 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: publish + +on: + push: + branches: + - master + paths: + - 'src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj' + +jobs: + check-bump-version: + runs-on: ubuntu-latest + outputs: + new-version: ${{ steps.diff.outputs.version }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 200 + - name: Get version from csproj + run: | + version="$(grep -o --color=never "[0-9]\+\.[0-9]\+\.[0-9]\+" src/Dena.CodeAnalysis.Testing.csproj sed 's///')" + echo "version=$version" >> "$GITHUB_OUTPUT" + id: diff + + publish: + needs: check-bump-version + if: ${{ needs.check-bump-version.outputs.new-version }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Setup .NET + uses: actions/setup-dotnet@main + with: + dotnet-version: '5.0.x' + + - name: dotnet build + run: dotnet build ./Dena.CodeAnalysis.Testing.sln + + - name: Create NuPkg + run: dotnet pack ./src/Dena.CodeAnalysis.Testing --include-symbols --configuration Release -o ./nupkg + + - name: Publish NuPkg + run: dotnet nuget push ./nupkg/Dena.CodeAnalysis.Testing.*.symbols.nupkg -Source https://api.nuget.org/v3/index.json --api-key $NUGET_AUTH_TOKEN + env: + NUGET_AUTH_TOKEN: ${{ secrets.APIKEY }} diff --git a/publish b/publish index 14a1349..7532a1a 100755 --- a/publish +++ b/publish @@ -37,7 +37,6 @@ get-version() { validate-env() { has dotnet || throw "dotnet must be installed (see https://docs.microsoft.com/ja-jp/dotnet/core/tools/)" - has nuget || throw "nuget must be installed (see https://docs.microsoft.com/ja-jp/nuget/install-nuget-client-tools)" } @@ -88,7 +87,7 @@ main() { local nupkg="./${NUPKG_BASENAME}" build "$nupkg" "$version" - nuget push "$nupkg" -Source https://api.nuget.org/v3/index.json + dotnet nuget push "$nupkg" -Source https://api.nuget.org/v3/index.json git push origin "$version" } From 101bcb27dc2ee75b9f59427debaccdd0ac70a3b1 Mon Sep 17 00:00:00 2001 From: get-me-power Date: Fri, 2 Feb 2024 15:56:53 +0900 Subject: [PATCH 2/4] delete publish command debug chore: add pipe chore: fix ci config chore: fix ci fix ci chore: fix ci --- .github/workflows/publish.yml | 11 ++-- publish | 95 ----------------------------------- 2 files changed, 6 insertions(+), 100 deletions(-) delete mode 100755 publish diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1f46e40..f51e2a5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,6 +6,9 @@ on: - master paths: - 'src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj' + pull_request: + paths: + - 'src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj' jobs: check-bump-version: @@ -18,7 +21,7 @@ jobs: fetch-depth: 200 - name: Get version from csproj run: | - version="$(grep -o --color=never "[0-9]\+\.[0-9]\+\.[0-9]\+" src/Dena.CodeAnalysis.Testing.csproj sed 's///')" + version="$(grep -o --color=never "[0-9]\+\.[0-9]\+\.[0-9]\+" src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj | sed 's///')" echo "version=$version" >> "$GITHUB_OUTPUT" id: diff @@ -34,12 +37,10 @@ jobs: dotnet-version: '5.0.x' - name: dotnet build - run: dotnet build ./Dena.CodeAnalysis.Testing.sln + run: dotnet build ./Dena.CodeAnalysis.Testing.sln --configuration Release - name: Create NuPkg run: dotnet pack ./src/Dena.CodeAnalysis.Testing --include-symbols --configuration Release -o ./nupkg - name: Publish NuPkg - run: dotnet nuget push ./nupkg/Dena.CodeAnalysis.Testing.*.symbols.nupkg -Source https://api.nuget.org/v3/index.json --api-key $NUGET_AUTH_TOKEN - env: - NUGET_AUTH_TOKEN: ${{ secrets.APIKEY }} + run: dotnet nuget push ./nupkg/Dena.CodeAnalysis.Testing.*.symbols.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} diff --git a/publish b/publish deleted file mode 100755 index 7532a1a..0000000 --- a/publish +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -set -euo pipefail - -BASE_DIR="$(cd "$(dirname "$0")"; pwd)" -NUPKG_BASENAME='Dena.CodeAnalysis.Testing.nupkg' - - -throw() { - local msg="$*" - printf '%s\n' "$msg" 1>&2 - false -} - - -has() { - local cmd="$1" - which "$cmd" >/dev/null 2>&1 -} - - -usage() { - cat - 1>&2 <<-EOS -usage: publish [] - -OPTIONS - -h, --help print this help -EOS -} - - -get-version() { - (cd "$BASE_DIR" - grep -o '[^<]*' ./src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj | sed 's/\([^<]*\).*/\1/' - ) -} - - -validate-env() { - has dotnet || throw "dotnet must be installed (see https://docs.microsoft.com/ja-jp/dotnet/core/tools/)" -} - - -acquire-tag() { - (cd "$BASE_DIR" - local version="$1" - if (git tag | grep -Fqx "$version"); then - throw "a tag has the same name exists on local, so if still you want to overwrite the tag, please remove the tag on local and try again.: '$version'" - fi - git tag "$version" - ) -} - - -build() { - local dst="$1" - local version="$2" - - (cd "$BASE_DIR" - dotnet build --no-incremental - - local nupkg_orig - nupkg_orig="./src/Dena.CodeAnalysis.Testing/bin/Debug/Dena.CodeAnalysis.Testing.${version}.nupkg" - [[ -f "$nupkg_orig" ]] || throw "no .nupkg found at '$nupkg_orig'" - - cp "$nupkg_orig" "$dst" - ) -} - - -main() { - local arg="${1:-}" - if [[ "$arg" == "--help" ]] || [[ "$arg" == "-h" ]]; then - usage - false - fi - if [[ "$arg" == "--version" ]] || [[ "$arg" == "-v" ]]; then - get-version - exit 0 - fi - - validate-env - - local version - version="$(get-version)" - acquire-tag "$version" - - local nupkg="./${NUPKG_BASENAME}" - build "$nupkg" "$version" - - dotnet nuget push "$nupkg" -Source https://api.nuget.org/v3/index.json - git push origin "$version" -} - - -main "$@" From 773aef53e9b383a28babd04bd4278f4a043e2bc7 Mon Sep 17 00:00:00 2001 From: get-me-power Date: Tue, 6 Feb 2024 02:55:32 +0900 Subject: [PATCH 3/4] ready to be v3.0.4 --- src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj b/src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj index 3bff4d1..3e99b3d 100644 --- a/src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj +++ b/src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj @@ -9,7 +9,7 @@ Dena.CodeAnalysis.Testing - 3.0.3 + 3.0.4 Kazuma Inagaki, Koji Hasegawa, Kuniwak false Test helpers for DiagnosticAnalyzers From eec5429cd3c52fbbbecdd6ba1983f39a672c3d42 Mon Sep 17 00:00:00 2001 From: get-me-power Date: Tue, 6 Feb 2024 16:10:55 +0900 Subject: [PATCH 4/4] chore: delete pr triger --- .github/workflows/publish.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f51e2a5..ca60fab 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,9 +6,6 @@ on: - master paths: - 'src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj' - pull_request: - paths: - - 'src/Dena.CodeAnalysis.Testing/Dena.CodeAnalysis.Testing.csproj' jobs: check-bump-version: