Skip to content

Commit b020c98

Browse files
authored
Merge pull request #2 from Flow-Launcher/github_action
Add GitHub Action
2 parents 3646e86 + 71b34d6 commit b020c98

File tree

4 files changed

+119
-2
lines changed

4 files changed

+119
-2
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "main" ]
7+
pull_request:
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: windows-latest
14+
15+
env:
16+
Dotnet_Version: 8.0.x
17+
Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
18+
19+
steps:
20+
21+
# Checkout codes
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
# Install the .NET Core workload
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: ${{ env.Dotnet_Version }}
30+
31+
# Restore dependencies
32+
- name: Restore dependencies
33+
run: dotnet restore ${{ env.Project_Path }}
34+
35+
# Build the project
36+
- name: Build
37+
run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore
38+
39+
# Execute all unit tests in the solution
40+
- name: Execute unit tests
41+
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
42+
run: dotnet test --configuration Release --no-build
43+
44+
# Pack the NuGet package
45+
- name: Create NuGet package
46+
run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs
47+
48+
# Upload the NuGet package
49+
- name: Upload NuGet package
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: Full nupkg
53+
path: nupkgs/Flow.Launcher.Localization.*.nupkg
54+
compression-level: 0

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- '*'
10+
11+
jobs:
12+
13+
build:
14+
15+
runs-on: windows-latest
16+
17+
env:
18+
Dotnet_Version: 8.0.x
19+
Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
20+
21+
steps:
22+
23+
# Checkout codes
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
# Install the .NET Core workload
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: ${{ env.Dotnet_Version }}
32+
33+
# Restore dependencies
34+
- name: Restore dependencies
35+
run: dotnet restore ${{ env.Project_Path }}
36+
37+
# Build the project
38+
- name: Build
39+
run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore
40+
41+
# Pack the NuGet package
42+
- name: Create NuGet package
43+
run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs
44+
45+
# # Publish to NuGet.org
46+
# - name: Push to NuGet
47+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
48+
# run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }}
49+
50+
# Get package version
51+
- name: Get Package Version
52+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
53+
run: |
54+
$version = [system.diagnostics.fileversioninfo]::getversioninfo("bin\Release\netstandard2.0\Flow.Launcher.Localization.dll").productversion
55+
echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append
56+
57+
# Publish to GitHub releases
58+
- name: Publish GitHub releases
59+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
files: "nupkgs\\*.nupkg"
63+
tag_name: "v${{ env.release_version }}"

Flow.Launcher.Localization.Analyzers/Flow.Launcher.Localization.Analyzers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Version>1.0.0</Version>

Flow.Launcher.Localization.SourceGenerators/Flow.Launcher.Localization.SourceGenerators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Version>1.0.0</Version>

0 commit comments

Comments
 (0)