diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 236fd8a26..a776b775d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,19 +1,34 @@ name: Publish Package to npmjs on: - release: - types: [published] + push: + branches: ['main', 'dev'] jobs: npm-publish: runs-on: ubuntu-latest + permissions: + issues: write + contents: write + packages: write + pull-requests: write + id-token: write steps: - uses: actions/checkout@v3 # Setup .npmrc file to publish to npm - uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - run: npm i -g bun - run: bun install --frozen-lockfile - - run: npm publish + - run: npm run release env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Merge main -> dev + uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f + if: github.ref == 'refs/heads/main' + with: + type: now + from_branch: main + target_branch: dev + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/bun.lockb b/bun.lockb index b6ad93574..13684d58f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 7ef790f6f..a45f99ce2 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,9 @@ "bin": { "tealscript": "dist/bin/tealscript.js" }, + "files": [ + "dist/**/*" + ], "scripts": { "test": "jest tests/", "test-coverage": "jest --coverage tests/", @@ -47,7 +50,8 @@ "compile-examples": "conc \"bun compile-amm\" \"bun compile-arc75\" \"bun compile-auction\" \"bun compile-itxns\" \"bun compile-simple\" \"bun compile-tuple_in_box\" \"bun compile-calculator\" \"bun compile-merkle\" \"bun compile-big_box\" \"bun compile-arc72\" \"bun compile-non_abi\"", "webpack-smoketest": "webpack --config tests/web/webpack.config.js", "pre-commit": "conc \"bun lint\" \"bun test\" \"bun test examples/\" \"bun run-examples\" \"bun webpack-smoketest\"", - "compile-all": "conc \"bun compile-tests\" \"bun compile-examples\"" + "compile-all": "conc \"bun compile-tests\" \"bun compile-examples\"", + "release": "semantic-release" }, "dependencies": { "@microsoft/tsdoc": "^0.14.2", @@ -60,8 +64,15 @@ "devDependencies": { "@algorandfoundation/algokit-client-generator": "^2.2.1", "@algorandfoundation/algokit-utils": "^2.1.0", + "@google/semantic-release-replace-plugin": "^1.2.7", "@jest/globals": "^29.5.0", "@knodes/typedoc-plugin-pages": "^0.23.1", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/commit-analyzer": "^10.0.1", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.0.4", + "@semantic-release/npm": "^10.0.4", + "@semantic-release/release-notes-generator": "^11.0.4", "@types/node": "^18.11.9", "@types/node-fetch": "^2.6.2", "@typescript-eslint/eslint-plugin": "^5.44.0", @@ -73,6 +84,7 @@ "eslint-plugin-import": "^2.26.0", "jest": "^29.5.0", "path-browserify": "^1.0.1", + "semantic-release": "^21.0.7", "ts-jest": "^29.1.0", "ts-loader": "^9.4.4", "ts-node": "^10.9.1", @@ -80,5 +92,60 @@ "typedoc-plugin-merge-modules": "^4.0.1", "webpack": "^5.88.1", "webpack-cli": "^5.1.4" + }, + "release": { + "plugins": [ + "@semantic-release/commit-analyzer", + [ + "@google/semantic-release-replace-plugin", + { + "replacements": [ + { + "files": [ + "src/version.ts" + ], + "from": "VERSION = '.*'", + "to": "VERSION = '${nextRelease.version}'", + "results": [ + { + "file": "src/version.ts", + "hasChanged": true, + "numMatches": 1, + "numReplacements": 1 + } + ], + "countMatches": true + } + ] + } + ], + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "@semantic-release/npm", + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "package.json", + "src/version.ts" + ], + "message": "chore(release): TEALScript \n\n${nextRelease.notes}" + } + ], + [ + "@semantic-release/github", + { + "successComment": false + } + ] + ], + "branches": [ + "main", + { + "name": "dev", + "prerelease": "beta" + } + ] } }