Skip to content

Commit

Permalink
Only publish interesting artifacts in GH build
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Dec 9, 2023
1 parent 9215491 commit abae184
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,26 @@ jobs:
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.100
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/package.json') }}
- name: 'Run: InstallDependencies, Compile, Test, Pack, Publish'
run: ./build.cmd InstallDependencies Compile Test Pack Publish
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: 'Publish: artifacts'
- name: 'Publish: NSwag.zip'
uses: actions/upload-artifact@v3
with:
name: NSwag.zip
path: artifacts/NSwag.zip
- name: 'Publish: NSwag.Npm.zip'
uses: actions/upload-artifact@v3
with:
name: NSwag.Npm.zip
path: artifacts/NSwag.Npm.zip
- name: 'Publish: NSwagStudio.msi'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
name: NSwagStudio.msi
path: artifacts/NSwagStudio.msi
11 changes: 0 additions & 11 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ jobs:
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: |
8.0.100
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/package.json') }}
- name: 'Run: InstallDependencies, Compile, Test, Pack'
run: ./build.cmd InstallDependencies Compile Test Pack
8 changes: 5 additions & 3 deletions build/Build.CI.GitHubActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
OnPullRequestExcludePaths = new[] { "**/*.md" },
PublishArtifacts = false,
InvokedTargets = new[] { nameof(InstallDependencies), nameof(Compile), nameof(Test), nameof(Pack) },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" },
CacheKeyFiles = new string[0],
JobConcurrencyCancelInProgress = true),
]
[CustomGitHubActions(
Expand All @@ -29,7 +29,7 @@
PublishArtifacts = true,
InvokedTargets = new[] { nameof(InstallDependencies), nameof(Compile), nameof(Test), nameof(Pack), nameof(Publish) },
ImportSecrets = new[] { "NUGET_API_KEY", "MYGET_API_KEY", "CHOCO_API_KEY", "NPM_AUTH_TOKEN" },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" })
CacheKeyFiles = new string[0])
]
public partial class Build
{
Expand All @@ -48,11 +48,13 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC
var newSteps = new List<GitHubActionsStep>(job.Steps);

// only need to list the ones that are missing from default image
/*
newSteps.Insert(0, new GitHubActionsSetupDotNetStep(new[]
{
"8.0.100"
}));

*/

newSteps.Insert(0, new GitHubActionsUseGnuTarStep());
newSteps.Insert(0, new GitHubActionsConfigureLongPathsStep());

Expand Down
5 changes: 4 additions & 1 deletion build/Build.Pack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class Build
Target Pack => _ => _
.DependsOn(Compile)
.After(Test)
.Produces(ArtifactsDirectory / "*.*")
.Produces(ArtifactsDirectory / "NSwag.zip", ArtifactsDirectory / "NSwag.Npm.zip", ArtifactsDirectory / "NSwagStudio.msi")
.Executes(() =>
{
if (Configuration != Configuration.Release)
Expand Down Expand Up @@ -127,6 +127,9 @@ public partial class Build
// ZIP directories
ZipFile.CreateFromDirectory(NSwagNpmBinaries, ArtifactsDirectory / "NSwag.Npm.zip");
ZipFile.CreateFromDirectory(NSwagStudioBinaries, ArtifactsDirectory / "NSwag.zip");

// NSwagStudio.msi
CopyFileToDirectory(ArtifactsDirectory / "bin" / "NSwagStudio.Installer" / Configuration / "NSwagStudio.msi", ArtifactsDirectory);
});
}

0 comments on commit abae184

Please sign in to comment.