Skip to content

Commit

Permalink
chore: order
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 4, 2025
1 parent d684f2f commit 9686af6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ on:
type: boolean
default: false

permissions:
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: write # required for creating release
pull-requests: write

Expand Down Expand Up @@ -129,9 +133,6 @@ jobs:
- name: Validate and normalize tag
id: validate
run: dotnet run --project "./src/CysharpActions/CysharpActions.csproj" --no-launch-profile -- validate-tag --tag "${{ inputs.tag }}" ${{ inputs.require-validation && '--require-validation' || '' }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Download(All) Artifacts to current directory
- uses: Cysharp/Actions/.github/actions/download-artifact@main
Expand All @@ -147,9 +148,6 @@ jobs:
# Create Releases
- name: Create Release
run: dotnet run --project "./src/CysharpActions/CysharpActions.csproj" --no-launch-profile -- create-release --tag "${{ inputs.tag }}" --release-title "${{ format(inputs.release-format, inputs.tag) }}" --release-asset-path-string "${{ inputs.release-asset-path }}"
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload to NuGet
- name: Upload to NuGet (DryRun=${{ inputs.dry-run }})
Expand Down
55 changes: 29 additions & 26 deletions src/CysharpActions/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CysharpActions;
#pragma warning disable CA1822 // Mark members as static
using CysharpActions;
using CysharpActions.Commands;
using CysharpActions.Contexts;
using CysharpActions.Utils;
Expand All @@ -13,28 +14,7 @@ namespace CysharpActions
{
public class ActionsBatch
{
#pragma warning disable CA1822 // Mark members as static

/// <summary>
/// Validate Tag and remove v prefix if exists
/// </summary>
/// <param name="tag">version string. ex) 1.0.0 OR v1.0.0</param>
/// <param name="requireValidation">Set true to exit 1 on fail. Set false to exit 0 even fail.</param>
/// <returns></returns>
[ConsoleAppFilter<GitHubCliFilter>]
[Command("validate-tag")]
public async Task ValidateTag(string tag, bool requireValidation)
{
var command = new ValidateTagCommand();
var normalizedTag = command.Normalize(tag);
if (requireValidation)
{
await command.ValidateTagAsync(normalizedTag);
}

GitHubActions.SetOutput("tag", tag);
GitHubActions.SetOutput("normalized-tag", normalizedTag);
}
// Clean package.json branch

/// <summary>
/// Delete Git branch
Expand All @@ -52,6 +32,8 @@ public async Task DeleteBranch(string branch)
GitHubActions.SetOutput("deleted", result.ToString().ToLower());
}

// Update package.json

/// <summary>
/// Update Version for specified path and commit.
/// </summary>
Expand Down Expand Up @@ -82,6 +64,29 @@ public async Task UpdateVersion(string version, string pathString, bool dryRun)
}
}

// Create Release

/// <summary>
/// Validate Tag and remove v prefix if exists
/// </summary>
/// <param name="tag">version string. ex) 1.0.0 OR v1.0.0</param>
/// <param name="requireValidation">Set true to exit 1 on fail. Set false to exit 0 even fail.</param>
/// <returns></returns>
[ConsoleAppFilter<GitHubCliFilter>]
[Command("validate-tag")]
public async Task ValidateTag(string tag, bool requireValidation)
{
var command = new ValidateTagCommand();
var normalizedTag = command.Normalize(tag);
if (requireValidation)
{
await command.ValidateTagAsync(normalizedTag);
}

GitHubActions.SetOutput("tag", tag);
GitHubActions.SetOutput("normalized-tag", normalizedTag);
}

/// <summary>
/// Validate specified path contains file
/// </summary>
Expand Down Expand Up @@ -136,7 +141,7 @@ public async Task CreateRelease(string tag, string releaseTitle, string releaseA
/// <param name="dryRun">Dry run or not</param>
/// <returns></returns>
[Command("nuget-push")]
public async Task PushNuGetPackage(string nugetPathString, string apiKey, bool dryRun)
public async Task NuGetPush(string nugetPathString, string apiKey, bool dryRun)
{
var nugetPaths = nugetPathString.ToMultiLine();

Expand Down Expand Up @@ -201,8 +206,6 @@ public async Task CreateDummy(string basePath)
var sha = await "git rev-parse HEAD";
return (commited, sha, branchName, isBranchCreated);
}

#pragma warning restore CA1822 // Mark members as static
}

internal class GlobalCompleteLogFilter(ConsoleAppFilter next) : ConsoleAppFilter(next)
Expand Down

0 comments on commit 9686af6

Please sign in to comment.