Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 42 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ on:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
release-type:
description: 'Type of release (major, minor, patch, alpha)'
required: true
default: patch
type: choice
options:
- major
- minor
- patch
- alpha

jobs:
continous-integration:
Expand Down Expand Up @@ -64,22 +76,34 @@ jobs:
- name: Build library
run: pnpm build

- name: Set NPM config
if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true')
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "always-auth=true" >> .npmrc

- name: Publish JavaScript Wrapper
if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true')
- name: Set the NPM config
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN

- name: Publish
id: publish
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ $(cat lerna.json | grep version | head -1 | grep dev) ]]; then
npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version --dist-tag=alpha
else
npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version
fi
echo ${{ inputs.release-type }}
git config --global user.name "Openwallet Foundation"

if [ ${{ inputs.release-type }} == 'alpha' ]; then
pnpm release --pre-dist-tag alpha prerelease --yes
else
pnpm release ${{ inputs.release-type }} --force-publish --no-private --yes
fi

version=$(node -p "require('./lerna.json').version")
echo "LERNA_VERSION=$version" >> "$GITHUB_OUTPUT"

- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
prerelease: ${{ inputs.release-type == 'alpha' }}
token: ${{ secrets.GH_TOKEN }}
tag_name: v${{ steps.publish.outputs.LERNA_VERSION }}
name: Release v${{ steps.publish.outputs.LERNA_VERSION }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "pnpm -r build",
"clean": "pnpm -r clean",
"test": "node --import tsx --test packages/**/tests/*.test.ts",
"set-version": "npx lerna version --exact --no-git-tag-version --no-push --yes"
"publish": "lerna publish"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Expand Down
Loading