Skip to content

Commit

Permalink
Update and future-proof build scripts
Browse files Browse the repository at this point in the history
First and most important: add unicode icons!
Second: instead of hardcoding `preview` as the VS being searched, leverage the ability to select the first instance greater than or equal to 16.8 we find on the machine. This means we won't be force-installing a preview VS when 16.8 becomes the built-in version in hosted agents. Also, it means when 16.9 or future versions become stable too, we won't need to modify scripts again, since we'll automatically use a later version this way.
  • Loading branch information
kzu committed Nov 20, 2020
1 parent 6db00a6 commit 36b33b9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 30 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: build
on: push

env:
Expand All @@ -9,30 +9,38 @@ jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: set version
- name: 🤘 checkout
uses: actions/checkout@v2
- name: 🖉 version
run: echo "VERSION_SUFFIX=$(git name-rev --name-only --refs=refs/heads/* HEAD).$($env:GITHUB_RUN_NUMBER)" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v1
- name: ⚙ dotnet 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100-rc.1.20452.10
- uses: actions/setup-dotnet@v1
dotnet-version: 5.0.x
- name: ⚙ dotnet 2.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- uses: actions/setup-dotnet@v1
- name: ⚙ dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- run: dotnet tool update -g dotnet-vs
- run: echo "MSB=$(vs where preview --prop=InstallationPath)" >> $GITHUB_ENV
- run: vs install preview --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
- name: 🔽 dotnet-vs
run: dotnet tool update -g dotnet-vs
- name: 🔍 vs 16.8+
run: echo "MSB=$(vs where --prop=InstallationPath --first -version 16.8)" >> $GITHUB_ENV
- name: 🔽 vs community
run: vs install community --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
if: env.MSB == ''
- run: echo "$(vs where preview --prop=InstallationPath)\MSBuild\Current\Bin" >> $GITHUB_PATH
- name: build
- name: ≥ msbuild
run: echo "$(vs where --prop=InstallationPath --first -version 16.8)\MSBuild\Current\Bin" >> $GITHUB_PATH
- name: 🙏 build
run: msbuild -r -p:versionsuffix=$($env:VERSION_SUFFIX)
- name: test
- name: 🧪 test
run: msbuild -t:test
- name: pack
- name: 📦 pack
run: msbuild -t:pack -p:nobuild=true -p:versionsuffix=$($env:VERSION_SUFFIX)
- name: sleet
- name: 🚀 sleet
run: |
dotnet tool install -g --version 3.2.0 sleet
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure"
38 changes: 23 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: release
on:
release:
types: [created]
Expand All @@ -12,29 +12,37 @@ jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: set version
- name: 🤘 checkout
uses: actions/checkout@v2
- name: 🖉 version
run: echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-dotnet@v1
- name: ⚙ dotnet 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100-rc.1.20452.10
- uses: actions/setup-dotnet@v1
dotnet-version: 5.0.x
- name: ⚙ dotnet 2.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
- uses: actions/setup-dotnet@v1
- name: ⚙ dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- run: dotnet tool update -g dotnet-vs
- run: echo "MSB=$(vs where preview --prop=InstallationPath)" >> $GITHUB_ENV
- run: vs install preview --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
- name: 🔽 dotnet-vs
run: dotnet tool update -g dotnet-vs
- name: 🔍 vs 16.8+
run: echo "MSB=$(vs where --prop=InstallationPath --first -version 16.8)" >> $GITHUB_ENV
- name: 🔽 vs community
run: vs install community --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
if: env.MSB == ''
- run: echo "$(vs where preview --prop=InstallationPath)\MSBuild\Current\Bin" >> $GITHUB_PATH
- name: build
- name: ≥ msbuild
run: echo "$(vs where --prop=InstallationPath --first -version 16.8)\MSBuild\Current\Bin" >> $GITHUB_PATH
- name: 🙏 build
run: msbuild -r -p:version=$($env:VERSION)
- name: test
- name: 🧪 test
run: msbuild -t:test
- name: pack
- name: 📦 pack
run: msbuild -t:pack -p:nobuild=true -p:version=$($env:VERSION)
- name: push
- name: 🚀 push
run: dotnet nuget push bin\**\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate

0 comments on commit 36b33b9

Please sign in to comment.