Fix cover not working #92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
workflow_dispatch: | |
pull_request_target: | |
branches: | |
- master | |
defaults: | |
run: | |
working-directory: src | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
with: | |
submodules: recursive | |
- name: Get main version from /version.json | |
id: version | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: version.json | |
prop_path: 'version' | |
- name: Output branch name | |
run: echo "github.ref ${{github.ref}} baseref ${{github.base_ref}} head ${{github.head_ref}}" | |
- name: Get branch name from github.ref | |
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }' | sed "s/[[:space:]_]/-/g")" | sed -e 's|/|-|g' >> $GITHUB_ENV | |
if: github.head_ref == '' | |
- name: Get branch name from PR | |
run: echo "BRANCH_NAME=PR-$(echo $GITHUB_HEAD_REF)" | sed -e 's|/|-|g' >> $GITHUB_ENV | |
if: github.head_ref != '' | |
- run: echo Version ${BRANCH_NAME} | |
- run: echo "PACKAGE_VERSION=${{steps.version.outputs.prop}}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
if: github.ref == 'refs/heads/master' && github.head_ref == '' | |
- run: echo "PACKAGE_VERSION=${{steps.version.outputs.prop}}.${GITHUB_RUN_NUMBER}-${BRANCH_NAME}-${GITHUB_SHA::8}" >> $GITHUB_ENV | |
if: github.ref != 'refs/heads/master' || github.head_ref != '' | |
- run: echo Version is ${PACKAGE_VERSION} | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
- name: Build | |
run: dotnet build --configuration Release --no-restore /p:Version="${PACKAGE_VERSION}" | |
- name: Test | |
run: dotnet test --no-restore --verbosity normal | |
if: false | |
## Publish and Tag | |
- name: Publish NuGet | |
run: dotnet nuget push WkHtmlToPdf-DotNet/bin/Release/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} | |
- name: Tag | |
run: | | |
git tag "v${PACKAGE_VERSION}" | |
git push origin "v${PACKAGE_VERSION}" | |
if: github.ref == 'refs/heads/master' |