Skip to content

Build -> Test -> Publish #37

Build -> Test -> Publish

Build -> Test -> Publish #37

name: Build -> Test -> Publish
on:
#pull_request:
# branches: [ "main", "release/*" ]
workflow_dispatch:
env:
DOTNET_VERSION: '6.0.x'
BINARY_MODULE_PATH: '.'
MODULE_NAME: 'PSDataverse'
jobs:
build:
runs-on: ubuntu-latest
environment:
name: PowerShell Gallery
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: |
pushd '${{ env.BINARY_MODULE_PATH}}'
dotnet restore
popd
- name: Build
run: |
pushd '${{ env.BINARY_MODULE_PATH}}'
dotnet build --no-restore --configuration Release --output ./output/${{ env.MODULE_NAME }}/bin
popd
- name: Test (.NET)
run: |
pushd '${{ env.BINARY_MODULE_PATH}}'
dotnet test --no-build --verbosity normal --output ./output/${{ env.MODULE_NAME }}/bin
popd
- name: Prepare package
shell: pwsh
run: |
pushd '${{ env.BINARY_MODULE_PATH}}'
Copy-Item "./src/Module/*" ./output/${{ env.MODULE_NAME }} -Recurse
popd
- name: Publish
shell: pwsh
run: |
pushd '${{ env.BINARY_MODULE_PATH}}'
Publish-Module -Path ./output/${{ env.MODULE_NAME }} -NuGetApiKey "${{ secrets.POWERSHELL_GALLERY_API_KEY }}"
popd