From c65568c09b06eb54ec69ef7eca0b153393f05f90 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Wed, 29 Jul 2020 17:29:22 +0900 Subject: [PATCH] build: update release script --- .github/workflows/package_release.yml | 37 +++++++++++++++++++ .github/workflows/push_package.sh | 16 -------- .github/workflows/release.yml | 35 ------------------ .../{update_roslyn.yml => roslyn_update.yml} | 0 ...roslyn_test.yml => roslyn_update_test.yml} | 0 .github/workflows/update_roslyn.sh | 25 ------------- package.json | 11 ++++-- 7 files changed, 44 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/package_release.yml delete mode 100755 .github/workflows/push_package.sh delete mode 100644 .github/workflows/release.yml rename .github/workflows/{update_roslyn.yml => roslyn_update.yml} (100%) rename .github/workflows/{update_roslyn_test.yml => roslyn_update_test.yml} (100%) delete mode 100755 .github/workflows/update_roslyn.sh diff --git a/.github/workflows/package_release.yml b/.github/workflows/package_release.yml new file mode 100644 index 000000000..28bfdd42e --- /dev/null +++ b/.github/workflows/package_release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + push: + branches: + - master + - alpha + - beta + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v2 + + - name: Cache Nuget + uses: actions/cache@v2 + with: + path: | + ~/.nuget/packages + ${{ github.workspace }}/roslyn/artifacts/obj + key: ${{ runner.os }}-nuget-and-artifacts-${{ hashFiles('**/eng/Versions.props') }} + restore-keys: ${{ runner.os }}-nuget-and-artifacts- + + - name: Cache Node + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + + - run: npm ci && npx semantic-release + env: + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/push_package.sh b/.github/workflows/push_package.sh deleted file mode 100755 index de8aab679..000000000 --- a/.github/workflows/push_package.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -ex - -VERSION=$1 -[ -z "${VERSION}" ] && exit -[ -z "${NUGET_TOKEN}" ] && exit - -PACKAGE_DIR=roslyn/artifacts/packages/Release/Shipping -PACKAGES=( \ - OpenSesame.Net.Compilers.Toolset \ - OpenSesame.Net.Compilers \ - OpenSesame.NETCore.Compilers \ -) - -for p in ${PACKAGES[@]}; do - dotnet nuget push ${PACKAGE_DIR}/${p}.${VERSION}.nupkg -k ${NUGET_TOKEN} -s https://api.nuget.org/v3/index.json --skip-duplicate -done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 565a85056..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Release - -on: - push: - branches: - - master - - alpha - - beta - -jobs: - build: - runs-on: ubuntu-latest - env: - NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages - - steps: - - - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget - restore-keys: ${{ runner.os }}-nuget- - - - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node - restore-keys: ${{ runner.os }}-node- - - - run: npm ci && npx semantic-release - env: - NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} - GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/update_roslyn.yml b/.github/workflows/roslyn_update.yml similarity index 100% rename from .github/workflows/update_roslyn.yml rename to .github/workflows/roslyn_update.yml diff --git a/.github/workflows/update_roslyn_test.yml b/.github/workflows/roslyn_update_test.yml similarity index 100% rename from .github/workflows/update_roslyn_test.yml rename to .github/workflows/roslyn_update_test.yml diff --git a/.github/workflows/update_roslyn.sh b/.github/workflows/update_roslyn.sh deleted file mode 100755 index 082a1da9c..000000000 --- a/.github/workflows/update_roslyn.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -ex - -# Get version from issue title. -VERSION=$1 -[ -z "${VERSION}" ] && exit - -# Find sha1 from nuget page. -SHA1=`curl -L https://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset/${VERSION} \ - | grep https://github.com/dotnet/roslyn/commit/ \ - | sed -e 's/.*\([0-9a-f]\{40\}\).*$/\1/' \ - | head -n 1` - -# Git settings. -git remote set-url origin https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }}.git -git config --local user.name GitHub -git config --local user.email noreply@github.com - -# Subtree merge from dotnet/roslyn. -[ -d roslyn ] && CMD=pull || CMD=add -git checkout -f roslyn -git subtree ${CMD} --prefix=roslyn --squash https://github.com/dotnet/roslyn.git ${SHA1} -m "Merge roslyn ${VERSION}" -m "https://github.com/dotnet/roslyn/commit/${SHA1}" -git push origin HEAD:roslyn - -git config --local --unset user.name -git config --local --unset user.email diff --git a/package.json b/package.json index e1832f71d..6f97c9cdc 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "package:format": "npx format-package -w", "package:update": "npx ncu -u && npm install && npm audit fix", "release": "npm ci && npx semantic-release", - "release:debug": "npm run release -- --dry-run --no-ci --debug" + "release:debug": "npm run release -- --dry-run --no-ci --debug", + "build:pack": "./tool.sh --pack", + "build:test": "./tool.sh --run-tests" }, "release": { "plugins": [ @@ -16,8 +18,9 @@ [ "@semantic-release/exec", { - "prepareCmd": "roslyn/build.sh --pack -r -c Release /p:PackageVersion=${nextRelease.version} /p:SemanticVersioningV1=false", - "publishCmd": ".github/workflows/push_package.sh ${nextRelease.version}" + "verifyConditionsCmd": "test -n \"$NUGET_TOKEN\"", + "prepareCmd": "./tool.sh --pack --run-tests --version ${nextRelease.version}", + "publishCmd": "./tool.sh --publish --version ${nextRelease.version} --token \"$NUGET_TOKEN\"" } ] ] @@ -26,4 +29,4 @@ "@semantic-release/exec": "^5.0.0", "semantic-release": "^17.1.1" } -} +} \ No newline at end of file