Skip to content

Commit

Permalink
fix error build
Browse files Browse the repository at this point in the history
  • Loading branch information
hungoptimizely committed Dec 6, 2023
1 parent 28ef2ab commit 9881719
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -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}
12 changes: 6 additions & 6 deletions build/get-versionSuffix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion src/@episerver/forms-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/@episerver/forms-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"test": "jest",
"publish": "npm publish"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/episerver"
},
"files": [
"dist"
],
Expand Down

0 comments on commit 9881719

Please sign in to comment.