Skip to content

Commit af69d0a

Browse files
authored
Merge pull request #4 from stesee/ZXingPoc
ZXing poc
2 parents 5d4fbd5 + 0deb7f3 commit af69d0a

File tree

4 files changed

+69
-39
lines changed

4 files changed

+69
-39
lines changed

.github/workflows/dotnet.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
git push origin --tags
3333
pwd
3434
35-
deployPreRelease:
36-
if: github.ref != 'refs/heads/main'
35+
deployRelease:
36+
if: github.ref == 'refs/heads/main'
3737
runs-on: ubuntu-latest
3838
needs: build
3939
steps:
@@ -46,27 +46,31 @@ jobs:
4646
run: dotnet restore
4747
- name: Build
4848
run: dotnet build --configuration Release --no-restore
49-
- name: Publish
50-
run: dotnet publish --configuration Release --no-restore
5149
- name: NugetPush
5250
run: |
51+
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
52+
- uses: "marvinpinto/action-automatic-releases@latest"
53+
with:
54+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
55+
automatic_release_tag: ${{ env.CURRENT_VERSION }}
56+
prerelease: false
57+
title: "Release Build"
58+
files: |
5359
ls ./GithubActionsHelloWorld/bin/Release
5460
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
55-
- uses: papeloto/action-zip@v1
56-
with:
57-
files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
58-
dest: GithubActionsHelloWorld.zip
5961
- uses: "marvinpinto/action-automatic-releases@latest"
6062
with:
6163
repo_token: "${{ secrets.GITHUB_TOKEN }}"
62-
automatic_release_tag: ${{ env.CURRENT_VERSION }}
64+
automatic_release_tag: "latest-prerelease"
6365
prerelease: true
66+
title: "Prerelease Build"
6467
files: |
6568
LICENSE
66-
GithubActionsHelloWorld.zip
69+
./GithubActionsHelloWorld/bin/Release/*.nupkg
70+
./GithubActionsHelloWorld/bin/Release/*.snupkg
6771
68-
deployRelease:
69-
if: github.ref == 'refs/heads/main'
72+
deployTest:
73+
if: github.ref != 'refs/heads/main'
7074
runs-on: ubuntu-latest
7175
needs: build
7276
steps:
@@ -79,23 +83,19 @@ jobs:
7983
run: dotnet restore
8084
- name: Build
8185
run: dotnet build --configuration Release --no-restore
82-
- name: Publish
83-
run: dotnet publish --configuration Release --no-restore
8486
- name: NugetPush
8587
run: |
8688
ls ./GithubActionsHelloWorld/bin/Release
8789
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
8890
# dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
89-
- uses: papeloto/action-zip@v1
90-
with:
91-
files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
92-
dest: GithubActionsHelloWorld.zip
9391
- uses: "marvinpinto/action-automatic-releases@latest"
9492
with:
9593
repo_token: "${{ secrets.GITHUB_TOKEN }}"
96-
automatic_release_tag: ${{ env.CURRENT_VERSION }}
94+
automatic_release_tag: "latest-prerelease"
95+
prerelease: true
96+
title: "Prerelease Build"
9797
files: |
9898
LICENSE
99-
GithubActionsHelloWorld.zip
100-
99+
./GithubActionsHelloWorld/bin/Release/*.nupkg
100+
./GithubActionsHelloWorld/bin/Release/*.snupkg
101101
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Reflection;
2+
3+
[assembly: AssemblyInformationalVersion(ThisAssembly.Git.Commit)]
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
6-
<Version Condition="'$(CURRENT_VERSION)' != ''">$(CURRENT_VERSION)</Version>
7-
<Version Condition="'$(CURRENT_VERSION)' == ''">0.0.1</Version>
8-
<AssemblyVersion>$(Version)</AssemblyVersion>
9-
<FileVersion>$(Version)</FileVersion>
10-
<PackageVersion>$(Version)</PackageVersion>
11-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12-
<IncludeSymbols>true</IncludeSymbols>
13-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
14-
<PackageId>GithubActionsHelloWorld</PackageId>
15-
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
16-
</PropertyGroup>
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<Version Condition="'$(CURRENT_VERSION)' != ''">$(CURRENT_VERSION)</Version>
7+
<Version Condition="'$(CURRENT_VERSION)' == ''">0.0.1</Version>
8+
<AssemblyVersion>$(Version)</AssemblyVersion>
9+
<InformationalVersion>$(GitCommit)</InformationalVersion>
10+
<FileVersion>$(Version)</FileVersion>
11+
<PackageVersion>$(Version)</PackageVersion>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<IncludeSymbols>true</IncludeSymbols>
14+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
15+
<PackageId>GithubActionsHelloWorld</PackageId>
16+
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
17+
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
18+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="GitInfo" Version="2.2.0" />
23+
<PackageReference Include="SixLabors.ImageSharp" Version="2.0.0" />
24+
<PackageReference Include="ZXing.Net" Version="0.16.8" />
25+
</ItemGroup>
1726

1827
</Project>

GithubActionsHelloWorld/Program.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
1-
using System;
1+
using SixLabors.ImageSharp;
2+
using SixLabors.ImageSharp.PixelFormats;
23
using System.Threading.Tasks;
4+
using ZXing.Common;
5+
using ZXing.Rendering;
36

47
namespace GithubActionsHelloWorld
58
{
69
public class Program
710
{
8-
public async static Task Main(string[] args)
11+
public static async Task Main(string[] args)
912
{
10-
await Task.Delay(100);
11-
Console.WriteLine("Hello World!");
13+
var barcodeWriter = new ZXing.BarcodeWriterPixelData
14+
{
15+
Format = ZXing.BarcodeFormat.CODE_128,
16+
Options = new EncodingOptions
17+
{
18+
Height = 300,
19+
Width = 300,
20+
},
21+
Renderer = new PixelDataRenderer
22+
{
23+
}
24+
};
25+
26+
var pixelData = barcodeWriter.Write("Hallo Barcode");
27+
28+
using (var image = Image.LoadPixelData<Rgba32>(pixelData.Pixels, 300, 300))
29+
await image.SaveAsBmpAsync("barcode.bmp");
1230
}
1331
}
1432
}

0 commit comments

Comments
 (0)