Skip to content

Commit

Permalink
ci: add workflow to release features (#70)
Browse files Browse the repository at this point in the history
* feat: check a theory

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd
  • Loading branch information
BusHero authored Sep 9, 2023
1 parent 508f892 commit 12b8f6a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/update-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,42 @@ jobs:
name: features
runs-on: ubuntu-latest
outputs:
templates: ${{ steps.changed_files.outputs.templates }}
features: ${{ steps.changed_files.outputs.features }}
changesToNuke: ${{ steps.changed_files.outputs.changesToNuke }}
steps:
- uses: actions/checkout@v3
name: pull branch
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
# - run: git switch main
- name: find changed templates & features
id: changed_files
run: |
ls -la features/src
./build.sh GetFeatures -All -GithubOutput "$GITHUB_OUTPUT"
release-feature:
if: ${{ needs.changes.outputs.features }}
needs: [changes]
name: Test feature ${{ matrix.feature }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
feature: ${{ fromJSON(needs.changes.outputs.features) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Cache: .nuke/temp, ~/.nuget/packages"
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: find changed templates & features
id: changed_files
run: ./build.sh ListTemplatesAndFeatures -GithubOutput "$GITHUB_OUTPUT"
- name: Install Node
uses: actions/setup-node@v3
- name: Run test for '${{ matrix.feature }}'
id: smoke_test
run: ./build.sh ReleaseFeature -Feature '${{ matrix.feature }}'
3 changes: 3 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"build": {
"type": "object",
"properties": {
"All": {
"type": "boolean"
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
Expand Down
6 changes: 5 additions & 1 deletion build/Build.Features.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Text.Json;

using Nuke.Common;
using Nuke.Common.IO;

using Serilog;

sealed partial class Build
Expand All @@ -11,6 +13,8 @@ sealed partial class Build

[Parameter] private readonly bool SkipAutoGenerated;

[Parameter] private readonly bool All = false;

[Parameter("Feature to build")] private readonly string Feature = null!;

private Target TestFeature => _ => _
Expand Down Expand Up @@ -71,7 +75,7 @@ sealed partial class Build
var features = Directory
.GetDirectories(FeaturesRoot / "src")
.Select(x => RootDirectory.GetRelativePathTo(x))
.Where(feature => Changes.Any(change => change.StartsWith(feature)))
.Where(feature => All || Changes.Any(change => change.StartsWith(feature)))
.Select(x => x.ToString())
.Select(Path.GetFileName)
.ToList();
Expand Down

0 comments on commit 12b8f6a

Please sign in to comment.