Build and Publish QPdf.RuntimeLibraries NuGet #356
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 QPdf.RuntimeLibraries NuGet | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
check: | |
outputs: | |
needs_new_package: ${{ steps.get-latest-release.outputs.needs_new_package }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: get-latest-release | |
name: Get Latest Release | |
run: | | |
QPDF_VERSION=$(curl --silent "https://api.github.com/repos/qpdf/qpdf/releases/latest" | jq -r .tag_name) | |
echo "qpdf_version=${QPDF_VERSION}" | |
NUGET_URL="https://globalcdn.nuget.org/packages/qpdf.runtimelibraries.${QPDF_VERSION:1}.nupkg" | |
echo "nuget_url=${NUGET_URL}" | |
PACKAGE_CHECK_EXIT_CODE=0 | |
curl -fsIo /dev/null "${NUGET_URL}" || PACKAGE_CHECK_EXIT_CODE=$? | |
echo "package_check_exit_code=${PACKAGE_CHECK_EXIT_CODE}" | |
NEEDS_NEW_PACKAGE=$([[ ${PACKAGE_CHECK_EXIT_CODE} -eq 0 ]] && echo 'false' || echo 'true') | |
echo "needs_new_package=${NEEDS_NEW_PACKAGE}" | |
echo "needs_new_package=${NEEDS_NEW_PACKAGE}" >> $GITHUB_OUTPUT | |
build: | |
needs: check | |
if: needs.check.outputs.needs_new_package == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Run Build-Runtime-Libraries Script | |
run: "${GITHUB_WORKSPACE}/scripts/build-runtime-libraries-nuget.sh" | |
- name: Verify NuGet Creation | |
run: ls -la ./artifacts | |
- name: Push NuGet Package | |
run: dotnet nuget push -k ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json ./artifacts/QPdf.RuntimeLibraries*.nupkg |