|
1 | 1 | # Action Name
|
2 | 2 | name: Main Automated Builds
|
3 | 3 |
|
4 |
| -# Environment Variables |
5 |
| -env: |
6 |
| - PROJECT_NAME: "RICADO.Modbus" |
7 |
| - |
8 |
| -# Controls when the action will run. |
| 4 | +# When the Action will Run |
9 | 5 | on:
|
10 | 6 | push:
|
11 | 7 | branches:
|
|
15 | 11 |
|
16 | 12 | # Workflow Jobs
|
17 | 13 | jobs:
|
18 |
| - # Build Job |
19 | 14 | build:
|
20 | 15 | runs-on: ubuntu-latest
|
21 | 16 | steps:
|
22 | 17 | # Step 1 - Checkout Code
|
23 | 18 | - name: Checkout Code
|
24 | 19 | uses: actions/checkout@v2
|
25 | 20 |
|
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 |
77 | 24 | 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.Modbus' |
| 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 |
0 commit comments