Skip to content

Commit 948c1d3

Browse files
authored
chore: added CD pipeline
1 parent eb58c5b commit 948c1d3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/cd.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CD
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
#on:
8+
# push:
9+
# tags:
10+
# - '*'
11+
12+
on:
13+
release:
14+
types: [published]
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: ubuntu-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v2
27+
28+
# Runs a single command using the runners shell
29+
- name: Setup .NET Core
30+
uses: actions/setup-dotnet@v1
31+
with:
32+
dotnet-version: 6.0.x
33+
34+
- name: Build
35+
run: dotnet build --configuration Release
36+
working-directory: ./src/FileSizeFromBase64.NET
37+
38+
- name: Run unit tests
39+
run: dotnet test --configuration Release
40+
working-directory: ./tests/FileSizeFromBase64.NET.Tests
41+
42+
- name: Generate nuget package
43+
run: dotnet pack --configuration Release -o nupkg
44+
working-directory: ./src/FileSizeFromBase64.NET
45+
46+
- name: Publish nuget package
47+
run: find . -name *.nupkg -type f -print0 | xargs -0 -I pkg dotnet nuget push pkg -k $nuget_api_key -s "https://api.nuget.org/v3/index.json" --skip-duplicate
48+
env:
49+
nuget_api_key: ${{ secrets.NUGET_API_KEY }}
50+
working-directory: ./src/FileSizeFromBase64.NET/nupkg

0 commit comments

Comments
 (0)