From 254d032153c47873dbe4c4e710f5cb7140bd29d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Wed, 1 Jun 2022 20:32:52 +0200 Subject: [PATCH 1/4] Configure automated NuGet release --- .github/workflows/{dotnet.yml => build.yml} | 2 +- ...tnet_pull_request.yml => pull_request.yml} | 2 +- .github/workflows/release.yml | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) rename .github/workflows/{dotnet.yml => build.yml} (98%) rename .github/workflows/{dotnet_pull_request.yml => pull_request.yml} (96%) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build.yml similarity index 98% rename from .github/workflows/dotnet.yml rename to .github/workflows/build.yml index e065ade66..1a12ee24b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: .NET +name: Build on: push: branches: [ 'v2.0' ] diff --git a/.github/workflows/dotnet_pull_request.yml b/.github/workflows/pull_request.yml similarity index 96% rename from .github/workflows/dotnet_pull_request.yml rename to .github/workflows/pull_request.yml index 223ebb014..e61276323 100644 --- a/.github/workflows/dotnet_pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,4 @@ -name: .NET (Pull Request) +name: Pull Request on: pull_request jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..113a81c6f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release +on: + push: + tags: ['[0-9]+.[0-9]+.[0-9]+'] + paths-ignore: [ 'docs/**' ] + +permissions: write-all + +jobs: + build: + runs-on: macos-latest + environment: nuget + env: + SLN_FILE: Fabulous-NoSamples.sln + steps: + - name: Extract version from tag + uses: damienaicheh/extract-version-from-tag-action@v1.0.0 + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.300 + - name: Restore + run: dotnet restore ${SLN_FILE} + - name: Build + run: dotnet build --no-restore --configuration Release ${SLN_FILE} + - name: Test + run: dotnet test --no-build --configuration Release ${SLN_FILE} + - name: Pack + run: | + sed -i bak "s/FABULOUS_PKG_VERSION/${MAJOR}.${MINOR}.${PATCH}/g" "templates/content/blank/.template.config/template.json" + dotnet pack --configuration Release --output nupkgs ${SLN_FILE} + dotnet pack --configuration Release --output nupkgs templates/Fabulous.XamarinForms.Templates.proj + - name: Push + run: | + dotnet nuget push "nupkgs/*.nupkg" -k ${{ secrets.NUGET_TOKEN }} --skip-duplicate From 48713b6901bc24f5332940d8dc3922a2722e8cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Wed, 1 Jun 2022 20:34:33 +0200 Subject: [PATCH 2/4] Include nuget.config to the template only for nightly builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a12ee24b..94d45b2b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: run: | sed -i bak "s/FABULOUS_PKG_VERSION/2.0.0-nightly-${GITHUB_RUN_ID}/g" "templates/content/blank/.template.config/template.json" dotnet pack --configuration Release --output nupkgs --version-suffix "nightly-${GITHUB_RUN_ID}" ${SLN_FILE} - dotnet pack --configuration Release --output nupkgs --version-suffix "nightly-${GITHUB_RUN_ID}" templates/Fabulous.XamarinForms.Templates.proj + dotnet pack -p:IsNightlyBuild=true --configuration Release --output nupkgs --version-suffix "nightly-${GITHUB_RUN_ID}" templates/Fabulous.XamarinForms.Templates.proj - name: Push run: | dotnet nuget push "nupkgs/*.nupkg" -s https://nuget.pkg.github.com/fsprojects/index.json -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate From bb960e5e1b1bf2ed62e576658d9d02c09c9544a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Wed, 1 Jun 2022 20:39:25 +0200 Subject: [PATCH 3/4] Exclude nuget config if IsNightlyBuild is not true --- templates/Fabulous.XamarinForms.Templates.proj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/Fabulous.XamarinForms.Templates.proj b/templates/Fabulous.XamarinForms.Templates.proj index 480f3d3ef..038884dfc 100644 --- a/templates/Fabulous.XamarinForms.Templates.proj +++ b/templates/Fabulous.XamarinForms.Templates.proj @@ -26,6 +26,12 @@ content/*/**/obj/**/*; content/*/**/bin/**/*; + + +$(ExcludeFromPackage); +content/*/nuget.config; + + content/ From 1549903265f5430b80a2ded6d2b7a4ccc62aad15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Wed, 1 Jun 2022 20:40:35 +0200 Subject: [PATCH 4/4] Bump to dotnet 6.0.300 --- .github/workflows/build.yml | 2 +- .github/workflows/pull_request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94d45b2b4..088565edf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.200 + dotnet-version: 6.0.300 - name: Restore run: dotnet restore ${SLN_FILE} - name: Build diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e61276323..7b66f3811 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -11,7 +11,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.200 + dotnet-version: 6.0.300 - name: Check code formatting run: | dotnet tool restore