Skip to content

Commit bb6521a

Browse files
committed
feat: initial commit
0 parents  commit bb6521a

File tree

8 files changed

+101
-0
lines changed

8 files changed

+101
-0
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
EXAMPLE_VALUE: example-value
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: ./
14+
id: dotnet-action
15+
with:
16+
example-input: ${{ env.EXAMPLE_VALUE}}
17+
- uses: nick-fields/assert-action@v1
18+
with:
19+
expected: ${{ env.EXAMPLE_VALUE }}
20+
actual: ${{ steps.dotnet-action.outputs.example-output }}
21+
comparison: exact

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .NET build artifacts
2+
bin/
3+
obj/
4+
5+
# Visual Studio files
6+
.vs/
7+
*.suo
8+
*.user
9+
*.sln.docstates
10+
11+
# NuGet packages
12+
*.nuget.props
13+
*.nuget.targets
14+
15+
# GitHub Actions artifacts
16+
**/bin/
17+
**/obj/
18+
**/*.suo
19+
**/*.user
20+
**/*.sln.docstates
21+
**/*.nuget.props
22+
**/*.nuget.targets
23+
24+
# Mono
25+
.mono

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
3+
COPY . ./
4+
5+
RUN dotnet publish ./DotNet.DockerAction/DotNet.DockerAction.csproj -c Release -o out --no-self-contained
6+
7+
FROM mcr.microsoft.com/dotnet/sdk:8.0
8+
9+
COPY --from=build /out .
10+
11+
ENTRYPOINT [ "dotnet", "/DotNet.DockerAction.dll" ]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

DotNet.DockerAction/GlobalUsings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global using System.Globalization;
2+
global using System.Text;
3+
global using System.Web;

DotNet.DockerAction/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+

2+
Console.WriteLine($"Hello from {args[0]}!");
3+
4+
var githubOutputFile = Environment.GetEnvironmentVariable("GITHUB_OUTPUT", EnvironmentVariableTarget.Process);
5+
6+
if (!string.IsNullOrWhiteSpace(githubOutputFile))
7+
{
8+
using (var textWriter = new StreamWriter(githubOutputFile!, true, Encoding.UTF8))
9+
{
10+
textWriter.WriteLine($"example-output={args[0]}");
11+
}
12+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# dotnet-docker-action
2+
This repository contains a basic template for creating your own dotnet based GitHub Docker Action. Feel free to use it and contribute.

action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: '.NET Docker Action Template'
2+
description: 'A Github action template for a dotnet docker action'
3+
branding:
4+
icon: sliders
5+
color: orange
6+
inputs:
7+
example-input:
8+
description: 'An example input'
9+
required: false
10+
outputs:
11+
example-output:
12+
description: 'An example output'
13+
runs:
14+
using: 'docker'
15+
image: 'Dockerfile'
16+
args:
17+
- ${{ inputs.example-input }}

0 commit comments

Comments
 (0)