Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 42 additions & 34 deletions .github/workflows/tripletex-sdk-dotnet-nuget.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,54 @@

name: Publish Nuget Package

on:
push:
branches: [ master, main ]
branches: [master, main]
pull_request:
branches: [ master, main ]
branches: [master, main]

env:
API_KEY: ${{ secrets.NUGET_PACKAGES_GITHUB_API_KEY }}

jobs:
build:

runs-on: ubuntu-latest

permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x

- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ./.github/variables/version.env

- name: Set package version
run: |
if [[ $GITHUB_REF == 'refs/heads/main' && $GITHUB_EVENT_NAME == 'push' ]]; then
echo "VERSION=${{ env.VERSION }}.${{ github.run_number}}" >> "$GITHUB_ENV"
else
echo "VERSION=${{ env.VERSION }}.${{ github.run_number}}-beta" >> "$GITHUB_ENV"
fi

- name: Package
working-directory: BccCode.Tripletex.Client
run: |
dotnet pack -p:PackageVersion=${{ env.VERSION }} -c Release -o . BccCode.Tripletex.Client.csproj -p:GeneratePackageOnBuild=false

- name: Publish
working-directory: BccCode.Tripletex.Client
run: |
dotnet nuget push BccCode.Tripletex.Client*.nupkg -k ${{env.API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x

- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ./.github/variables/version.env

- name: Set package version
run: |
if [[ $GITHUB_REF == 'refs/heads/main' && $GITHUB_EVENT_NAME == 'push' ]]; then
echo "VERSION=${{ env.VERSION }}.${{ github.run_number}}" >> "$GITHUB_ENV"
else
echo "VERSION=${{ env.VERSION }}.${{ github.run_number}}-beta" >> "$GITHUB_ENV"
fi

- name: Package
working-directory: BccCode.Tripletex.Client
run: |
dotnet pack -p:PackageVersion=${{ env.VERSION }} -c Release -o . BccCode.Tripletex.Client.csproj -p:GeneratePackageOnBuild=false

- uses: NuGet/login@v1
id: login
with:
user: ${{vars.NUGET_USER}}

- name: Publish
working-directory: BccCode.Tripletex.Client
run: |
dotnet nuget push BccCode.Tripletex.Client*.nupkg \
--api-key ${{ steps.login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
Loading