Skip to content

Commit

Permalink
feat: ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Eimaen committed Aug 19, 2024
1 parent c184774 commit 8d10749
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI/CD MusixmatchClientLib

on:
push:
pull_request:

jobs:
mxmcl-cicd:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "3.1.x"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "5.0.x"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Restore Packages
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --verbosity minimal
- name: Publish to NuGET
run: ./publish.sh
if: startsWith( github.ref, 'refs/tags/')
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Publish to GH Release
uses: actions/create-release@v1
if: startsWith( github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: MusixmatchClientLib ${{ github.ref }}
body: |
TODO
draft: true
prerelease: false
- name: Upload to GH Release
if: startsWith( github.ref, 'refs/tags/')
run: |
zip -j MusixmatchClientLib-netstandard2.0.zip MusixmatchClientLib/bin/Release/netstandard2.0/*
zip -j MusixmatchClientLib-netstandard2.1.zip MusixmatchClientLib/bin/Release/netstandard2.1/*
zip -j MusixmatchClientLib-net5.0.zip MusixmatchClientLib/bin/Release/net5.0/*
zip -j MusixmatchClientLib-net6.0.zip MusixmatchClientLib/bin/Release/net6.0/*
zip -j MusixmatchClientLib-net7.0.zip MusixmatchClientLib/bin/Release/net7.0/*
zip -j MusixmatchClientLib-net8.0.zip MusixmatchClientLib/bin/Release/net8.0/*
gh release upload "$RELEASE_VERSION" \
"MusixmatchClientLib-netstandard2.0.zip" \
"MusixmatchClientLib-netstandard2.1.zip" \
"MusixmatchClientLib-net5.0.zip" \
"MusixmatchClientLib-net6.0.zip" \
"MusixmatchClientLib-net7.0.zip" \
"MusixmatchClientLib-net8.0.zip" \
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

echo "Publishing..."

cd ./MusixmatchClientLib
dotnet pack -c Release MusixmatchClientLib.csproj -p:PackageVersion="$RELEASE_VERSION"
nuget push "./bin/Release/MusixmatchClientLib.$RELEASE_VERSION.nupkg"\
-ApiKey "$NUGET_TOKEN"\
-NonInteractive\
-Source https://www.nuget.org/api/v2/package

cd ..

0 comments on commit 8d10749

Please sign in to comment.