Skip to content

Commit

Permalink
Merge pull request #941 from TimLariviere/configure-cd
Browse files Browse the repository at this point in the history
Configure automated NuGet release
  • Loading branch information
TimLariviere authored Jun 1, 2022
2 parents 2af7018 + 1549903 commit 617c716
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET
name: Build
on:
push:
branches: [ 'v2.0' ]
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET (Pull Request)
name: Pull Request
on: pull_request

jobs:
Expand All @@ -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
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- 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
6 changes: 6 additions & 0 deletions templates/Fabulous.XamarinForms.Templates.proj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ content/*/**/obj/**/*;
content/*/**/bin/**/*;
</ExcludeFromPackage>
</PropertyGroup>
<PropertyGroup Condition=" $(IsNightlyBuild) != 'true' ">
<ExcludeFromPackage>
$(ExcludeFromPackage);
content/*/nuget.config;
</ExcludeFromPackage>
</PropertyGroup>
<ItemGroup>
<Content Include="content/**/*" Exclude="$(ExcludeFromPackage)">
<PackagePath>content/</PackagePath>
Expand Down

0 comments on commit 617c716

Please sign in to comment.