Skip to content

Publish Preview

Publish Preview #12

Workflow file for this run

name: Publish Preview
on:
workflow_dispatch:
inputs:
reason:
description: 'Reason for running the action'
required: false
default: 'Pre-Release'
private:
description: 'Whether to publish to the private feed'
required: false
default: 'true'
public:
description: 'Whether to publish to the public NuGet feed'
required: false
default: 'false'
env:
APNSTEST__BUNDLEID: ${{ vars.APNSTEST__BUNDLEID }}
APNSTEST__DEVICETOKEN: ${{ secrets.APNSTEST__DEVICETOKEN }}
APNSTEST__ENVIRONMENT: 'Production'
APNSTEST__KEYID: ${{ secrets.APNSTEST__KEYID }}
APNSTEST__PRIVATEKEY: ${{ secrets.APNSTEST__PRIVATEKEY }}
APNSTEST__TEAMID: ${{ vars.APNSTEST__TEAMID }}
FCMLEGACYTEST__KEY: ${{ secrets.FCMLEGACYTEST__KEY }}
FCMLEGACYTEST__REGISTRATIONID: ${{ secrets.FCMLEGACYTEST__REGISTRATIONID }}
FIREBASETEST__CLIENTEMAIL: ${{ secrets.FIREBASETEST__CLIENTEMAIL }}
FIREBASETEST__DEVICETOKEN: ${{ secrets.FIREBASETEST__DEVICETOKEN }}
FIREBASETEST__PRIVATEKEY: ${{ secrets.FIREBASETEST__PRIVATEKEY }}
FIREBASETEST__PROJECTID: ${{ vars.FIREBASETEST__PROJECTID }}
FIREBASETEST__TOKENURI: ${{ vars.FIREBASETEST__TOKENURI }}
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: '7'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build
- name: Pack
run: >
dotnet pack
--configuration Release
--no-build
--verbosity normal
--output $GITHUB_WORKSPACE/drop
-p:PackageVersion=$GITVERSION_NUGETVERSION
- name: Publish Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/drop/*
name: drop
PrivateFeed:
runs-on: ubuntu-latest
needs: Build
if: ${{ github.event.inputs.private == 'true' }}
steps:
- uses: actions/download-artifact@v4
with:
name: drop
path: ${{ github.workspace }}/drop
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
source-url: ${{ secrets.PRIVATE_FEED_URL }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PRIVATE_FEED_API_KEY }}
- name: Publish to private feed
# if: startsWith(github.ref, 'refs/tags/')
run: >
dotnet nuget push "$GITHUB_WORKSPACE/drop/*"
-k ${{ secrets.PRIVATE_FEED_API_KEY }}
--skip-duplicate
PublicFeed:
runs-on: ubuntu-latest
needs: Build
if: ${{ github.event.inputs.public == 'true' }}
steps:
- uses: actions/download-artifact@v4
with:
name: drop
path: ${{ github.workspace }}/drop
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
- name: Publish to NuGet.org
# if: startsWith(github.ref, 'refs/tags/')
run: >
dotnet nuget push "$GITHUB_WORKSPACE/drop/*"
-k ${{ secrets.NUGET_API_KEY }}
--skip-duplicate