You can use Runly’s nuget protocol integration to setup a Continuous Deployment pipeline in GitHub Actions to automatically deploy your built jobs package to Runly on every push to master
.
Authentication
Before you begin, you will need to create an Application API key so that your GitHub Action can connect to the Runly API. Create a new non-public Application, GitHub CD, and copy the API key.
You can make use of GitHub’s repository secrets to safely store the API key so that it will not leak in logs. Create a new secret called RUNLY_API_KEY
and paste your API key as the value.
Sample Workflow
You can create a new file called runly.yml
in the .github/workflows
folder of your repository. Here is a sample workflow that will build & pack a .NET application and then push it to Runly.
name: Runly
on:
push:
branches:
- master
jobs:
pushToRunly:
name: Deploy to Runly
runs-on: ubuntu-latest
- uses: actions/checkout@v2
- name: Pack
run: dotnet pack src/MyApp --configuration Release -o .
- name: Push
run: dotnet nuget push *.nupkg -k ${{ secrets.RUNLY_API_KEY }} -s https://api.runly.io/myorg/packages/
Be sure to replace src/MyApp
with the path to the project you want to package as well as myorg
in the URL with your organization ID. The organization ID can be found from your dashboard by navigating to Settings ➡️ General ➡️ API ID.
Versioning
Runly packages rely heavily on semantic versioning. You can introduce a project like GitVersion or Nerdbank.GitVersioning to automate the versioning process for you. Here is the same sample workflow from above but amended to include versioning using Nerdbank.GitVersioning:
name: Runly
on:
push:
branches:
- master
jobs:
pushToRunly:
name: Deploy to Runly
runs-on: ubuntu-latest
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work
# version using NerdBank.GitVersioning
- uses: aarnott/nbgv@v0.3
id: nbgv
- name: Pack
run: dotnet pack src/MyApp --configuration Release -p:Version=${{ steps.nbgv.outputs.SemVer2 }} -o .
- name: Push
run: dotnet nuget push *.nupkg -k ${{ secrets.RUNLY_API_KEY }} -s https://api.runly.io/myorg/packages/
You will then need to add a version.json
to your repository root:
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0",
"publicReleaseRefSpec": [
"^refs/heads/master$"
]
}
This will automatically increment the version number and deploy the updated package to Runly on every commit to master
. Learn more about NBGV.