Added first workflows for building docs and ci/cd

This commit is contained in:
Jonas Dellinger 2020-11-14 09:40:07 +01:00
parent c2b118a9b3
commit b14fa9547f
4 changed files with 70 additions and 31 deletions

27
.github/workflows/cicd.yaml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Build/Test/Release SpotifyAPI-NET
on:
push:
pull_request:
jobs:
spotifyapi-net-cicd:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.2.x"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Restore Packages
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --verbosity minimal
- name: Test
run: dotnet test SpotifyAPI.Web.Tests

18
.github/workflows/docs.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Build/Deploy Documentation
on:
push:
branches: [$default-branch]
jobs:
build-deploy-docs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.JS
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Build & Deploy Documentation
run: ./SpotifyAPI.Docs/docs.sh

View File

@ -2,19 +2,15 @@
set -e
if [ -z "$APPVEYOR_PULL_REQUEST_NUMBER" ]; then
if [ "$APPVEYOR_REPO_BRANCH" = "master" ]; then
echo "Building docs..."
echo "Building docs..."
echo "$GH_DEPLOY_TOKEN" | base64 -d > "$HOME/.ssh/id_rsa"
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
echo "$GH_DEPLOY_TOKEN" | base64 -d > "$HOME/.ssh/id_rsa"
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
git config --global user.email "jonas@dellinger.dev"
git config --global user.name "AppVeyor Docs Builder"
git config --global user.email "jonas@dellinger.dev"
git config --global user.name "GH Actions Docs Builder"
cd ./SpotifyAPI.Docs
yarn
USE_SSH=true GIT_USER=JohnnyCrazy yarn deploy
fi
fi
cd ./SpotifyAPI.Docs
yarn
USE_SSH=true GIT_USER=JohnnyCrazy yarn deploy

View File

@ -2,25 +2,23 @@
set -e
if [ "$APPVEYOR_REPO_TAG" = "true" ]; then
echo "Publishing..."
echo "Publishing..."
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
alias nuget="mono /usr/local/bin/nuget.exe"
cd ./SpotifyAPI.Web
dotnet pack -c Release SpotifyAPI.Web.csproj -p:PackageVersion="$APPVEYOR_REPO_TAG_NAME"
nuget push "./bin/Release/SpotifyAPI.Web.$APPVEYOR_REPO_TAG_NAME.nupkg"\
-ApiKey "$NUGET_TOKEN"\
-NonInteractive\
-Source https://www.nuget.org/api/v2/package
cd ./SpotifyAPI.Web
dotnet pack -c Release SpotifyAPI.Web.csproj -p:PackageVersion="$APPVEYOR_REPO_TAG_NAME"
nuget push "./bin/Release/SpotifyAPI.Web.$APPVEYOR_REPO_TAG_NAME.nupkg"\
-ApiKey "$NUGET_TOKEN"\
-NonInteractive\
-Source https://www.nuget.org/api/v2/package
cd ../SpotifyAPI.Web.Auth
dotnet pack -c Release SpotifyAPI.Web.Auth.csproj -p:PackageVersion="$APPVEYOR_REPO_TAG_NAME"
nuget push "./bin/Release/SpotifyAPI.Web.Auth.$APPVEYOR_REPO_TAG_NAME.nupkg"\
-ApiKey "$NUGET_TOKEN"\
-NonInteractive\
-Source https://www.nuget.org/api/v2/package
cd ../SpotifyAPI.Web.Auth
dotnet pack -c Release SpotifyAPI.Web.Auth.csproj -p:PackageVersion="$APPVEYOR_REPO_TAG_NAME"
nuget push "./bin/Release/SpotifyAPI.Web.Auth.$APPVEYOR_REPO_TAG_NAME.nupkg"\
-ApiKey "$NUGET_TOKEN"\
-NonInteractive\
-Source https://www.nuget.org/api/v2/package
cd ..
fi
cd ..