Skip to content

Commit 3a949e4

Browse files
authored
Created the main.yml Actions Workflow
1 parent ac821d8 commit 3a949e4

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/main.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Action Name
2+
name: Main Automated Builds
3+
4+
# Environment Variables
5+
env:
6+
PROJECT_NAME: "RICADO.Configuration"
7+
8+
# Controls when the action will run.
9+
on:
10+
push:
11+
branches:
12+
- main
13+
tags:
14+
- '*.*.*'
15+
16+
# Workflow Jobs
17+
jobs:
18+
# Build Job
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
# Step 1 - Checkout Code
23+
- name: Checkout Code
24+
uses: actions/checkout@v2
25+
26+
# Step 2 - Extract Environment Variables
27+
- name: Extract Environment Variables
28+
uses: FranzDiebold/[email protected]
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"
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"
61+
62+
# Step 9 - Create New Release
63+
- name: Create New Release
64+
id: create-release
65+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
66+
uses: actions/create-release@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
tag_name: ${{ env.CI_REF_NAME }}
71+
release_name: ${{ env.PROJECT_NAME }} ${{ env.CI_REF_NAME }}
72+
body: |
73+
${{ env.PROJECT_NAME }} Version ${{ env.CI_REF_NAME }}
74+
75+
Built Automatically with :heart: using GitHub Actions

0 commit comments

Comments
 (0)