Skip to content

Commit 9897585

Browse files
authored
Add files via upload
1 parent 10a766a commit 9897585

File tree

4 files changed

+348
-0
lines changed

4 files changed

+348
-0
lines changed
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: CI-Package-Release
2+
'on':
3+
pull_request:
4+
types: [opened, reopened, edited, synchronize]
5+
paths-ignore:
6+
- "**/*.md"
7+
- "**/*.gitignore"
8+
- "**/*.gitattributes"
9+
jobs:
10+
Run-Lint:
11+
runs-on: ubuntu-latest
12+
env:
13+
github-token: '${{ secrets.GH_Packages }}'
14+
steps:
15+
- name: Step-01 Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Step-02 Lint Code Base
20+
uses: github/super-linter@v4
21+
env:
22+
VALIDATE_ALL_CODEBASE: false
23+
FILTER_REGEX_INCLUDE: .*src/.*
24+
DEFAULT_BRANCH: master
25+
GITHUB_TOKEN: '${{ env.github-token }}'
26+
Build-Beta:
27+
if: ${{ !startsWith(github.head_ref, 'release/')}}
28+
runs-on: ubuntu-latest
29+
outputs:
30+
semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }}
31+
branchName: ${{ steps.gitversion.outputs.branchName }}
32+
env:
33+
working-directory: /home/runner/work/FileUtil.Core/FileUtil.Core
34+
35+
steps:
36+
- name: Step-01 Install GitVersion
37+
uses: gittools/actions/gitversion/[email protected]
38+
with:
39+
versionSpec: 5.x
40+
41+
- name: Step-02 Check out Code
42+
uses: actions/checkout@v2
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Step-03 Calculate Version
47+
id: gitversion
48+
uses: gittools/actions/gitversion/[email protected]
49+
with:
50+
useConfigFile: true
51+
52+
- name: Step-04 Install .NET
53+
uses: actions/setup-dotnet@v3
54+
with:
55+
dotnet-version: 6.0.x
56+
57+
- name: Step-05 Restore dependencies
58+
run: dotnet restore
59+
working-directory: '${{ env.working-directory }}'
60+
61+
- name: Step-06 Build Beta Version
62+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }}
63+
working-directory: '${{ env.working-directory }}'
64+
65+
- name: Step-07 Test Solution
66+
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
67+
working-directory: '${{ env.working-directory }}'
68+
69+
- name: Step-08 Upload Build Artifacts
70+
uses: actions/upload-artifact@v3
71+
with:
72+
name: build-artifact
73+
path: ${{env.working-directory}}
74+
retention-days: 1
75+
Build-Release:
76+
if: ${{ startsWith(github.head_ref, 'release/') }}
77+
runs-on: ubuntu-latest
78+
outputs:
79+
semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }}
80+
branchName: ${{ steps.gitversion.outputs.branchName }}
81+
env:
82+
working-directory: /home/runner/work/FileUtil.Core/FileUtil.Core
83+
84+
steps:
85+
- name: Step-01 Install GitVersion
86+
uses: gittools/actions/gitversion/[email protected]
87+
with:
88+
versionSpec: 5.x
89+
90+
- name: Step-02 Check out Code
91+
uses: actions/checkout@v2
92+
with:
93+
fetch-depth: 0
94+
95+
- name: Step-03 Calculate Version
96+
id: gitversion
97+
uses: gittools/actions/gitversion/[email protected]
98+
with:
99+
useConfigFile: true
100+
101+
- name: Step-04 Install .NET
102+
uses: actions/setup-dotnet@v3
103+
with:
104+
dotnet-version: 8.0.x
105+
106+
- name: Step-05 Restore dependencies
107+
run: dotnet restore
108+
working-directory: '${{ env.working-directory }}'
109+
110+
- name: Step-06 Build Release Version
111+
if: ('startsWith(github.ref, ''refs/heads/release'')')
112+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
113+
working-directory: '${{ env.working-directory }}'
114+
115+
- name: Step-07 Test Solution
116+
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
117+
working-directory: '${{ env.working-directory }}'
118+
119+
- name: Step-08 Upload Build Artifacts
120+
uses: actions/upload-artifact@v3
121+
with:
122+
name: build-artifact
123+
path: ${{env.working-directory}}
124+
retention-days: 1
125+
Package-Release:
126+
needs: [Build-Beta, Build-Release]
127+
if: |
128+
always() &&
129+
(needs.Build-Beta.result == 'success' || needs.Build-Release.result == 'success')
130+
runs-on: ubuntu-latest
131+
outputs:
132+
semVersion: ${{ needs.Build-Release.outputs.semVersion }}
133+
env:
134+
github-token: '${{ secrets.GH_Packages }}'
135+
nuget-token: '${{ secrets.NUGET_API_KEY }}'
136+
working-directory: /home/runner/work/FileUtil.Core/FileUtil.Core
137+
steps:
138+
- name: Step-01 Retrieve Build Artifacts
139+
uses: actions/download-artifact@v3
140+
with:
141+
name: build-artifact
142+
path: ${{env.working-directory}}
143+
144+
- name: Step-02 Install Github Packages
145+
run: dotnet tool install gpr --global
146+
147+
- name: Step-03 Publish to Github Packages
148+
run: find -name "*.nupkg" -print -exec gpr push -k ${{env.github-token}} {} \;
149+
150+
- name: Step-02 Create Github Release
151+
if: ${{ startsWith(github.head_ref, 'release/')}}
152+
run: |
153+
curl \
154+
-X POST \
155+
-H "Accept:application/vnd.github+json" \
156+
-H "Authorization:token ${{ env.github-token }}" \
157+
https://api.github.com/codeshayk/FileUtil.Core/releases \
158+
-d '{"tag_name":v1.0.0,"target_commitish":"master","name":"FileUtil.Core","body":"","draft":false,"prerelease":false,"generate_release_notes":false}'
159+
160+
- name: Step-03 Release to Nuget Org
161+
if: ${{ startsWith(github.head_ref, 'release/')}}
162+
run: dotnet nuget push ${{env.working-directory}}/src/FileUtil/bin/Release/*.nupkg --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json

.github/workflows/Master-Build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Master-Build
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v3
16+
with:
17+
dotnet-version: 6.0.x
18+
- name: Restore dependencies
19+
run: dotnet restore
20+
- name: Build
21+
run: dotnet build --no-restore
22+
- name: Test
23+
run: dotnet test --no-build --verbosity normal
24+
25+
run-Lint:
26+
runs-on: ubuntu-latest
27+
env:
28+
github-token: '${{ secrets.GH_Packages }}'
29+
steps:
30+
- name: Step-01 Checkout code
31+
uses: actions/checkout@v3
32+
with:
33+
fetch-depth: 0
34+
- name: Step-02 Lint Code Base
35+
uses: github/super-linter@v4
36+
env:
37+
VALIDATE_ALL_CODEBASE: false
38+
FILTER_REGEX_INCLUDE: .*src/.*
39+
DEFAULT_BRANCH: master
40+
GITHUB_TOKEN: '${{ env.github-token }}'
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "Master-CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
schedule:
18+
- cron: '35 15 * * 2'
19+
20+
jobs:
21+
analyze:
22+
name: Analyze
23+
runs-on: ubuntu-latest
24+
permissions:
25+
actions: read
26+
contents: read
27+
security-events: write
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
language: [ 'csharp' ]
33+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
34+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v2
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
49+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
50+
# queries: security-extended,security-and-quality
51+
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v2
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60+
61+
# If the Autobuild fails above, remove it and uncomment the following three lines.
62+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63+
64+
# - run: |
65+
# echo "Run, Build Application using script"
66+
# ./location_of_script_within_repo/buildscript.sh
67+
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@v2
70+
with:
71+
category: "/language:${{matrix.language}}"

.github/workflows/PR-CodeQL.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "PR-CodeQL"
13+
14+
on:
15+
pull_request:
16+
types: [opened, reopened, edited, synchronize]
17+
paths-ignore:
18+
- "**/*.md"
19+
- "**/*.gitignore"
20+
- "**/*.gitattributes"
21+
schedule:
22+
- cron: '35 15 * * 2'
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
permissions:
29+
actions: read
30+
contents: read
31+
security-events: write
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
language: [ 'csharp' ]
37+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
38+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v3
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v2
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
53+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
54+
# queries: security-extended,security-and-quality
55+
56+
57+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
58+
# If this step fails, then you should remove it and run the build manually (see below)
59+
- name: Autobuild
60+
uses: github/codeql-action/autobuild@v2
61+
62+
# ℹ️ Command-line programs to run using the OS shell.
63+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
64+
65+
# If the Autobuild fails above, remove it and uncomment the following three lines.
66+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
67+
68+
# - run: |
69+
# echo "Run, Build Application using script"
70+
# ./location_of_script_within_repo/buildscript.sh
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v2
74+
with:
75+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)