Skip to content

Commit

Permalink
task: Build on GHA and publish to GPR (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrmn authored Jul 28, 2023
1 parent 227ae2c commit cd46cbd
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 18 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Package

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
packages: write

jobs:
build:

runs-on: [self-hosted, nonroot]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
prefix: CI_
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.x
3.1.x
- name: Restore dependencies
run: dotnet restore
- name: Nerdbank.GitVersioning
id: nbgv
uses: dotnet/[email protected]
- name: Build version (master)
if: env.CI_GITHUB_REF_SLUG == 'master'
run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}" >> $GITHUB_ENV
- name: Build version (PR)
if: env.CI_GITHUB_REF_SLUG != 'master'
run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}-${{ env.CI_GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release -p:Version=${{ env.PUBLISH_VERSION }} --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build -p:PackageVersion=${{ env.PUBLISH_VERSION }}
- name: Push
run: dotnet nuget push **EPPlus.HTML/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/urbansportsclub/index.json --skip-duplicate --no-symbols
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion EPPlus.Html/EPPlus.Html.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>EPPlus.Html</PackageId>
<Version>0.3.0</Version>
<Authors>Till Wolff, Andreas Rudischhauser</Authors>
<Description>This is a wrapper around EPPlus</Description>
<Copyright>Fitogram GmbH</Copyright>
Expand Down
15 changes: 15 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0.0",
"assemblyVersion": {
"precision": "revision"
},
"publicReleaseRefSpec": [
"^refs/heads/master$"
],
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}

0 comments on commit cd46cbd

Please sign in to comment.