Skip to content

Commit

Permalink
build: Test release
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Sep 26, 2024
1 parent 925abf4 commit dac7272
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
node-version: 20.x
run-build: true
run-commit-lint: true
pre-test-script: |
pipx install algokit
algokit localnet start
build-script: npm run build
audit-script: npm run audit
upload-artifact-name: puya-ts
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,22 @@ jobs:
with:
path: artifacts

- name: Prepare @algorandfoundation/algo-ts
run: cp .releaserc.json artifacts/algo-ts/.releaserc.json

- name: Publish @algorandfoundation/algo-ts
uses: JS-DevTools/npm-publish@v3
id: publish-algo-ts
with:
token: ${{ secrets.npm-auth-token }}
package: artifacts/algo-ts/package.json
access: 'public'
dry-run: true

- name: Update puya-ts' peer dependency on algo-ts
run: npx tsx ../scripts/update-algo-ts-peer-dep.ts ${{ steps.publish-algo-ts.version }}
working-directory: artifacts/puya-ts

- name: Publish @algorandfoundation/puya-ts
run: npx semantic-release
working-directory: artifacts/algo-ts/

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.npm-auth-token }}
4 changes: 2 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
[
"@semantic-release/npm",
{
"npmPublish": true,
"pkgRoot": "."
"npmPublish": false,
"pkgRoot": "artifacts/puya-ts"
}
],
"@semantic-release/github"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:3-build": "rollup -c --configPlugin typescript",
"build:4-copy-pkg-json": "tstk copy-package-json -c",
"build:5-copy-readme": "copyfiles ./README.md ./dist",
"test": "vitest run --exclude 'packages/**'",
"test": "vitest run",
"test:approvals": "vitest run tests/approvals/_run.spec.ts",
"test:expected-output": "vitest run tests/expected-output/_run.spec.ts",
"test:coverage": "vitest run --coverage",
Expand Down
2 changes: 1 addition & 1 deletion packages/algo-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algorandfoundation/algo-ts",
"version": "1.0.0",
"version": "0.0.1-alpha.1",
"description": "",
"main": "index.js",
"types": "src/index.ts",
Expand Down
30 changes: 30 additions & 0 deletions scripts/update-algo-ts-peer-dep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable no-console */
import fs from 'fs'

const AlgoTsPackageName = '@algorandfoundation/algo-ts'
const newVersion = process.argv[2]

const SemVersionReg = /^\d+\.\d+\.\d+(-((beta)|(alpha)(\.\d+)?)?)$/

if (!SemVersionReg.test(newVersion)) {
console.error(`Arg 2 of '${newVersion}' should be an npm compatible semantic version number`)
process.exit(1)
}

if (!fs.existsSync('package.json')) {
console.error('No package.json file could be found in the current working directory')
process.exit(2)
}

console.info('Loading package.json file')
const pkgJsonText = fs.readFileSync('package.json', 'utf-8')
const pkgJsonObj = JSON.parse(pkgJsonText)

if (!pkgJsonObj['peerDependencies']) {
pkgJsonObj['peerDependencies'] = {}
}
console.info(`Setting peer dependency on ${AlgoTsPackageName} to ${newVersion}`)
pkgJsonObj['peerDependencies'][AlgoTsPackageName] = newVersion

fs.writeFileSync('package.json', JSON.stringify(pkgJsonObj, undefined, 2))
console.info('Writing updated package.json')

0 comments on commit dac7272

Please sign in to comment.