Skip to content

Commit 8d10749

Browse files
committed
feat: ci/cd
1 parent c184774 commit 8d10749

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/cicd.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI/CD MusixmatchClientLib
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
mxmcl-cicd:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- uses: actions/setup-dotnet@v3
14+
with:
15+
dotnet-version: "3.1.x"
16+
- uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: "5.0.x"
19+
- uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: "6.0.x"
22+
- uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: "7.0.x"
25+
- uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: "8.0.x"
28+
- name: Set RELEASE_VERSION
29+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
30+
- name: Restore Packages
31+
run: dotnet restore
32+
- name: Build
33+
run: dotnet build --configuration Release --verbosity minimal
34+
- name: Publish to NuGET
35+
run: ./publish.sh
36+
if: startsWith( github.ref, 'refs/tags/')
37+
env:
38+
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
39+
- name: Publish to GH Release
40+
uses: actions/create-release@v1
41+
if: startsWith( github.ref, 'refs/tags/')
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
tag_name: ${{ github.ref }}
46+
release_name: MusixmatchClientLib ${{ github.ref }}
47+
body: |
48+
TODO
49+
draft: true
50+
prerelease: false
51+
- name: Upload to GH Release
52+
if: startsWith( github.ref, 'refs/tags/')
53+
run: |
54+
zip -j MusixmatchClientLib-netstandard2.0.zip MusixmatchClientLib/bin/Release/netstandard2.0/*
55+
zip -j MusixmatchClientLib-netstandard2.1.zip MusixmatchClientLib/bin/Release/netstandard2.1/*
56+
zip -j MusixmatchClientLib-net5.0.zip MusixmatchClientLib/bin/Release/net5.0/*
57+
zip -j MusixmatchClientLib-net6.0.zip MusixmatchClientLib/bin/Release/net6.0/*
58+
zip -j MusixmatchClientLib-net7.0.zip MusixmatchClientLib/bin/Release/net7.0/*
59+
zip -j MusixmatchClientLib-net8.0.zip MusixmatchClientLib/bin/Release/net8.0/*
60+
gh release upload "$RELEASE_VERSION" \
61+
"MusixmatchClientLib-netstandard2.0.zip" \
62+
"MusixmatchClientLib-netstandard2.1.zip" \
63+
"MusixmatchClientLib-net5.0.zip" \
64+
"MusixmatchClientLib-net6.0.zip" \
65+
"MusixmatchClientLib-net7.0.zip" \
66+
"MusixmatchClientLib-net8.0.zip" \
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Publishing..."
6+
7+
cd ./MusixmatchClientLib
8+
dotnet pack -c Release MusixmatchClientLib.csproj -p:PackageVersion="$RELEASE_VERSION"
9+
nuget push "./bin/Release/MusixmatchClientLib.$RELEASE_VERSION.nupkg"\
10+
-ApiKey "$NUGET_TOKEN"\
11+
-NonInteractive\
12+
-Source https://www.nuget.org/api/v2/package
13+
14+
cd ..

0 commit comments

Comments
 (0)