Skip to content

Commit 9a49cad

Browse files
committed
Updated to .NET 6 and improved Actions Workflows
1 parent adf373b commit 9a49cad

File tree

6 files changed

+49
-112
lines changed

6 files changed

+49
-112
lines changed
Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,48 @@
1+
# Action Name
12
name: "CodeQL"
23

3-
# Environment Variables
4-
env:
5-
PROJECT_NAME: "RICADO.Omron"
6-
4+
# When the Action will Run
75
on:
8-
push:
9-
branches: [ master ]
10-
pull_request:
11-
branches: [ master ]
126
schedule:
13-
- cron: '15 18 * * 0'
7+
- cron: '0 7 * * 5'
148

9+
# Workflow Jobs
1510
jobs:
11+
# Analyze Job
1612
analyze:
17-
if: github.actor != 'dependabot[bot]'
1813
name: Analyze
1914
runs-on: ubuntu-latest
15+
2016
permissions:
2117
actions: read
2218
contents: read
2319
security-events: write
2420

25-
strategy:
26-
fail-fast: false
27-
matrix:
28-
language: [ 'csharp' ]
29-
3021
steps:
31-
# Step 1 - Checkout Code
32-
- name: Checkout Code
33-
uses: actions/checkout@v2
34-
35-
# Step 2 - Initialize CodeQL
36-
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v1
38-
with:
39-
languages: ${{ matrix.language }}
40-
41-
# Step 3 - Setup .NET 5 with GitHub Packages Authentication
42-
- name: Setup .NET 5 with GitHub Packages Authentication
43-
uses: actions/setup-dotnet@v1
44-
with:
45-
dotnet-version: '5.0.100'
46-
source-url: https://nuget.pkg.github.com/ricado-group/index.json
47-
env:
48-
NUGET_AUTH_TOKEN: ${{ secrets.GH_ACTIONS_PAT }}
49-
50-
# Step 4 - Restore NuGet Packages
51-
- name: Restore NuGet Packages
52-
run: dotnet restore "${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj"
53-
54-
# Step 5 - Build the Library
55-
- name: Build the Library
56-
run: dotnet build "${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj" -c Release
57-
58-
# Step 6 - Perform CodeQL Analysis
59-
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@v1
22+
# Step 1 - Checkout Code
23+
- name: Checkout Code
24+
uses: actions/checkout@v2
25+
26+
# Step 2 - Initialize CodeQL
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v1
29+
with:
30+
languages: csharp
31+
queries: security-and-quality
32+
33+
# Step 3 - Setup .NET 6 with GitHub Packages Authentication
34+
- name: Setup .NET 6 with GitHub Packages Authentication
35+
uses: actions/setup-dotnet@v1
36+
with:
37+
dotnet-version: 6.0.x
38+
source-url: https://nuget.pkg.github.com/ricado-group/index.json
39+
env:
40+
NUGET_AUTH_TOKEN: ${{ secrets.GH_ACTIONS_PAT }}
41+
42+
# Step 4 - Build the Library
43+
- name: Run CodeQL Autobuild
44+
uses: github/codeql-action/autobuild@v1
45+
46+
# Step 5 - Perform CodeQL Analysis
47+
- name: Perform CodeQL Analysis
48+
uses: github/codeql-action/analyze@v1

.github/workflows/main.yml

Lines changed: 10 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Action Name
22
name: Main Automated Builds
33

4-
# Environment Variables
5-
env:
6-
PROJECT_NAME: "RICADO.Omron"
7-
8-
# Controls when the action will run.
4+
# When the Action will Run
95
on:
106
push:
117
branches:
@@ -15,67 +11,20 @@ on:
1511

1612
# Workflow Jobs
1713
jobs:
18-
# Build Job
1914
build:
2015
runs-on: ubuntu-latest
2116
steps:
2217
# Step 1 - Checkout Code
2318
- name: Checkout Code
2419
uses: actions/checkout@v2
2520

26-
# Step 2 - Extract Environment Variables
27-
- name: Extract Environment Variables
28-
uses: FranzDiebold/github-env-vars-action@v2.3.0
29-
30-
# Step 3 - Setup .NET 5 with GitHub Packages Authentication
31-
- name: Setup .NET 5 with GitHub Packages Authentication
32-
uses: actions/setup-dotnet@v1
33-
with:
34-
dotnet-version: '5.0.100'
35-
source-url: https://nuget.pkg.github.com/ricado-group/index.json
36-
env:
37-
NUGET_AUTH_TOKEN: ${{ secrets.GH_ACTIONS_PAT }}
38-
39-
# Step 4 - Restore NuGet Packages
40-
- name: Restore NuGet Packages
41-
run: dotnet restore "${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj"
42-
43-
# Step 5 - Build the Library
44-
- name: Build the Library
45-
run: dotnet build "${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj" -c Release
46-
47-
# Step 6 - Pack the Library
48-
- name: Pack the Library
49-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
50-
run: dotnet pack "${{ env.PROJECT_NAME}}/${{ env.PROJECT_NAME }}.csproj" -c Release -p:PackageVersion=${{ env.CI_REF_NAME }}
51-
52-
# Step 7 - Push the Package to GitHub Packages
53-
- name: Push the Package to GitHub Packages
54-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
55-
run: dotnet nuget push "${{ env.PROJECT_NAME }}/bin/Release/*.nupkg" -k ${{ secrets.GH_ACTIONS_PAT }} -s "https://nuget.pkg.github.com/ricado-group/index.json" --skip-duplicate
56-
57-
# Step 8 - Push the Package to NuGet
58-
- name: Push the Package to Nuget
59-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
60-
run: dotnet nuget push "${{ env.PROJECT_NAME }}/bin/Release/*.nupkg" -k ${{ secrets.NUGET_APIKEY }} -s "https://api.nuget.org/v3/index.json" --skip-duplicate
61-
62-
# Step 9 - Generate the Changelog
63-
- name: Generate the Changelog
64-
id: changelog
65-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
66-
uses: metcalfc/changelog-generator@v3.0.0
67-
with:
68-
myToken: ${{ secrets.GITHUB_TOKEN }}
69-
70-
# Step 10 - Create New Release
71-
- name: Create New Release
72-
id: create-release
73-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
74-
uses: actions/create-release@v1
75-
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
# Step 2 - Build and Publish
22+
- name: Build and Publish
23+
uses: ricado-group/dotnet-library-build-release-action@v1.2
7724
with:
78-
tag_name: ${{ env.CI_REF_NAME }}
79-
release_name: Version ${{ env.CI_REF_NAME }}
80-
body: |
81-
${{ steps.changelog.outputs.changelog }}
25+
project-name: 'RICADO.Omron'
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
private-nuget-url: 'https://nuget.pkg.github.com/ricado-group/index.json'
28+
private-nuget-token: ${{ secrets.GH_ACTIONS_PAT }}
29+
public-nuget-token: ${{ secrets.NUGET_APIKEY }}
30+
publish-public: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# RICADO.Omron
2-
An Omron PLC Communication Library for .NET 5 Applications
2+
An Omron PLC Communication Library for .NET 6 Applications

RICADO.Omron/OmronPLC.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ public bool IsInitialized
115115

116116
public string ControllerVersion => _controllerVersion;
117117

118-
public ushort MaximumReadWordLength => _plcType == enPLCType.CP1 ? 499 : 999;
118+
public ushort MaximumReadWordLength => _plcType == enPLCType.CP1 ? (ushort)499 : (ushort)999;
119119

120-
public ushort MaximumWriteWordLength => _plcType == enPLCType.CP1 ? 496 : 996;
120+
public ushort MaximumWriteWordLength => _plcType == enPLCType.CP1 ? (ushort)496 : (ushort)996;
121121

122122
#endregion
123123

RICADO.Omron/RICADO.Omron.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<Authors>RICADO Group</Authors>
66
<Company>RICADO Group LP</Company>
7-
<Description>An Omron PLC Communication Library for .NET 5 Applications</Description>
7+
<Description>An Omron PLC Communication Library for .NET 6 Applications</Description>
88
<Copyright>Copyright © RICADO Group LP 2009 - 2021</Copyright>
99
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1010
<PackageIcon>packageIcon.png</PackageIcon>

RICADO.Omron/Requests/WriteMemoryAreaBitRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected override List<byte> BuildRequestData()
115115
data.AddRange(BitConverter.GetBytes((ushort)_values.Length).Reverse());
116116

117117
// Bit Values
118-
data.AddRange(_values.Select<bool, byte>(value => value == true ? 1 : 0));
118+
data.AddRange(_values.Select<bool, byte>(value => value == true ? (byte)1 : (byte)0));
119119

120120
return data;
121121
}

0 commit comments

Comments
 (0)