diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff84f79..4a635d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,18 @@ on: pull_request: branches: [ "develop" ] +permissions: + contents: write + packages: write + id-token: write + +env: + NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: build: - - runs-on: ubuntu-latest + name: Build, test, and publish + runs-on: windows-latest env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} strategy: @@ -43,7 +51,7 @@ jobs: - name: Apply Versioning run: | echo "running on branch" ${{env.BRANCH_NAME}} - ${{ github.workspace}}\build\get-versionSuffix.ps1 ${{env.BRANCH_NAME}} ${{github.RUN_NUMBER}} + ${{ github.workspace}}/build/get-versionSuffix.ps1 ${{env.BRANCH_NAME}} ${{github.RUN_NUMBER}} - name: Publish run: npm run publish diff --git a/.npmrc b/.npmrc index b9372a4..4d06da2 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,3 @@ -registry=https://npm.pkg.github.com/episerver/ +@episerver:registry=https://npm.pkg.github.com/episerver/ always-auth=true //npm.pkg.github.com/episerver/:_authToken=${NPM_AUTH_TOKEN} \ No newline at end of file diff --git a/build/get-versionSuffix.ps1 b/build/get-versionSuffix.ps1 index 7327b4c..20ae93f 100644 --- a/build/get-versionSuffix.ps1 +++ b/build/get-versionSuffix.ps1 @@ -34,27 +34,27 @@ switch -wildcard ($branchName) { default { $preReleaseInfo = "-ci-{0:D6}" } } <# update version for forms-sdk #> -$json = (Get-Content @episerver/forms-sdk/package.json -Raw) +$json = (Get-Content src/@episerver/forms-sdk/package.json -Raw) $versionSuffix = "$preReleaseInfo" -f $buildCounter -$version = (Get-Content @episerver/forms-sdk/package.json) -join "`n" | ConvertFrom-Json | Select-Object -ExpandProperty "version" +$version = (Get-Content src/@episerver/forms-sdk/package.json) -join "`n" | ConvertFrom-Json | Select-Object -ExpandProperty "version" Write-Output "Version read from package.json: $version" Write-Output "Version suffix: $versionSuffix" $fullVersion = "$version$versionSuffix" Write-Output "Package version: $fullVersion" -$json -replace $version,$fullVersion | Set-Content -Path @episerver/forms-sdk/package.json +$json -replace $version,$fullVersion | Set-Content -Path src/@episerver/forms-sdk/package.json <# update version for forms-react #> -$json = (Get-Content @episerver/forms-react/package.json -Raw) +$json = (Get-Content src/@episerver/forms-react/package.json -Raw) $versionSuffix = "$preReleaseInfo" -f $buildCounter -$version = (Get-Content @episerver/forms-react/package.json) -join "`n" | ConvertFrom-Json | Select-Object -ExpandProperty "version" +$version = (Get-Content src/@episerver/forms-react/package.json) -join "`n" | ConvertFrom-Json | Select-Object -ExpandProperty "version" Write-Output "Version read from package.json: $version" Write-Output "Version suffix: $versionSuffix" $fullVersion = "$version$versionSuffix" Write-Output "Package version: $fullVersion" -$json -replace $version,$fullVersion | Set-Content -Path @episerver/forms-react/package.json +$json -replace $version,$fullVersion | Set-Content -Path src/@episerver/forms-react/package.json diff --git a/src/@episerver/forms-react/package.json b/src/@episerver/forms-react/package.json index 71fbd76..f5fa926 100644 --- a/src/@episerver/forms-react/package.json +++ b/src/@episerver/forms-react/package.json @@ -14,7 +14,9 @@ "build": "rollup -c --context window", "publish": "npm publish" }, - "private": true, + "publishConfig": { + "registry": "https://npm.pkg.github.com/episerver" + }, "keywords": [], "dependencies": { "@episerver/forms-sdk": "file:../forms-sdk" diff --git a/src/@episerver/forms-sdk/package.json b/src/@episerver/forms-sdk/package.json index 95e2d53..2c8aa49 100644 --- a/src/@episerver/forms-sdk/package.json +++ b/src/@episerver/forms-sdk/package.json @@ -13,6 +13,9 @@ "test": "jest", "publish": "npm publish" }, + "publishConfig": { + "registry": "https://npm.pkg.github.com/episerver" + }, "files": [ "dist" ],