Skip to content
Open
29 changes: 18 additions & 11 deletions .github/workflows/publish-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ on:
default: ""
description: The version of the packages to publish publicly
required: false
dry-run:
type: boolean
default: false
description: Run the pipeline but don't actually publish anything.

permissions:
id-token: write # Required for OIDC
contents: read

jobs:
copy-nuget-packages:
Expand Down Expand Up @@ -46,7 +54,8 @@ jobs:
-nuGetOrgApiKey "${{ secrets.NUGET_ORG_API_KEY }}" `
-include '${{ inputs.include }}' `
-exclude '${{ inputs.exclude }}' `
-version "${{ inputs.version }}"
-version '${{ inputs.version }}' `
-dryRun ${{ inputs.dry-run && '$true' || '$false' }}
shell: pwsh

copy-npm-packages:
Expand Down Expand Up @@ -90,17 +99,15 @@ jobs:
ls
working-directory: ./artifacts

- name: Set public npm registry
if: steps.include-check.outputs.match == 'true'
run: >
${{ github.workspace }}/ci/scripts/Set-NpmRegistry.ps1 `
-targetDirectory "." `
-registry "https://registry.npmjs.org/" `
-authToken "${{ secrets.PUBLIC_NPM_PAT }}"
shell: pwsh
working-directory: ./artifacts/node_modules/dotvvm-types
- uses: actions/setup-node@v6
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Upgrade npm
run: npm install -g npm@latest

- name: Publish dotvvm-types to registry.npmjs.org
if: steps.include-check.outputs.match == 'true'
run: npm publish --verbose
run: NODE_AUTH_TOKEN="" npm publish --verbose ${{ inputs.dry-run && '--dry-run' || '' }} --tag latest
working-directory: ./artifacts/node_modules/dotvvm-types
15 changes: 10 additions & 5 deletions ci/scripts/Copy-NuGetPackages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ param(
[string]$internalNuGetFeedName = "riganti",
[string]$include = "*",
[string]$exclude = "",
[string]$version = ""
[string]$version = "",
[bool]$dryRun = $false
)

if (-not (Test-Path "$root")) {
Expand Down Expand Up @@ -73,10 +74,14 @@ try {
Write-Host "::group::Pushing packages to NuGet.org"
try {
foreach ($package in (Get-ChildItem "$packagesDir/**/*.nupkg")) {
nuget push "$($package.FullName)" `
-Source "nuget.org" `
-ApiKey "$nuGetOrgApiKey" `
-NonInteractive
if (!($dryRun)) {
nuget push "$($package.FullName)" `
-Source "nuget.org" `
-ApiKey "$nuGetOrgApiKey" `
-NonInteractive
} else {
Write-Host "Skipping 'nuget push' because dry run is active."
}
}
} finally {
Write-Host "::endgroup::"
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading