Correct v1.6 destTokenAddress and sourcePoolAddress encoding (#60) #23
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'stable' | |
| type: choice | |
| options: | |
| - stable | |
| - beta | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: publish | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Validate version consistency | |
| run: | | |
| # Only validate version consistency for tag-based triggers | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v.* ]]; then | |
| # Extract version from tag (e.g., v0.2.7-beta -> 0.2.7-beta) | |
| TAG_VERSION="${{ github.ref_name }}" | |
| if [[ "$TAG_VERSION" == v* ]]; then | |
| TAG_VERSION="${TAG_VERSION#v}" | |
| fi | |
| # Get version from package.json | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "Tag version: $TAG_VERSION" | |
| echo "Package.json version: $PACKAGE_VERSION" | |
| # Check if versions match | |
| if [[ "$TAG_VERSION" != "$PACKAGE_VERSION" ]]; then | |
| echo "❌ Version mismatch detected!" | |
| echo "Tag version: $TAG_VERSION" | |
| echo "Package.json version: $PACKAGE_VERSION" | |
| echo "Please ensure the tag version matches package.json version" | |
| exit 1 | |
| fi | |
| echo "✅ Version consistency validated" | |
| else | |
| echo "⚠️ Manual dispatch detected - skipping version validation" | |
| echo "Using package.json version: $(node -p "require('./package.json').version")" | |
| fi | |
| - name: Determine release type and validate branch | |
| id: release-type | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v.* ]]; then | |
| # Check if tag contains 'beta' to determine release type | |
| if [[ "${{ github.ref_name }}" == *"-beta"* ]]; then | |
| echo "type=beta" >> $GITHUB_OUTPUT | |
| echo "expected_branch=develop" >> $GITHUB_OUTPUT | |
| else | |
| echo "type=stable" >> $GITHUB_OUTPUT | |
| echo "expected_branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| # Manual dispatch - use input | |
| echo "type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT | |
| if [[ "${{ github.event.inputs.release_type }}" == "beta" ]]; then | |
| echo "expected_branch=develop" >> $GITHUB_OUTPUT | |
| else | |
| echo "expected_branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| - name: Validate branch for release type | |
| run: | | |
| EXPECTED_BRANCH="${{ steps.release-type.outputs.expected_branch }}" | |
| RELEASE_TYPE="${{ steps.release-type.outputs.type }}" | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v.* ]]; then | |
| TAG_NAME="${{ github.ref_name }}" | |
| TAG_SHA="${{ github.sha }}" | |
| echo "Tag: $TAG_NAME" | |
| echo "Tag commit: $TAG_SHA" | |
| echo "Expected branch for $RELEASE_TYPE release: $EXPECTED_BRANCH" | |
| # Ensure expected branch ref exists locally. | |
| if ! git fetch --no-tags --prune origin "${EXPECTED_BRANCH}"; then | |
| echo "❌ Branch validation failed!" | |
| echo "Could not fetch expected branch from origin: $EXPECTED_BRANCH" | |
| exit 1 | |
| fi | |
| if ! git show-ref --verify --quiet "refs/remotes/origin/${EXPECTED_BRANCH}"; then | |
| echo "❌ Branch validation failed!" | |
| echo "Could not fetch expected branch: $EXPECTED_BRANCH" | |
| exit 1 | |
| fi | |
| # Validate the tagged commit belongs to expected branch history. | |
| if ! git merge-base --is-ancestor "$TAG_SHA" "origin/${EXPECTED_BRANCH}"; then | |
| echo "❌ Branch validation failed!" | |
| echo "Tag commit is not contained in branch: $EXPECTED_BRANCH" | |
| echo "Please create the tag from the correct branch" | |
| exit 1 | |
| fi | |
| echo "✅ Tag ancestry validation passed" | |
| exit 0 | |
| fi | |
| # workflow_dispatch: validate selected branch directly. | |
| CURRENT_BRANCH="${{ github.ref_name }}" | |
| echo "Selected workflow branch: $CURRENT_BRANCH" | |
| echo "Expected branch for $RELEASE_TYPE release: $EXPECTED_BRANCH" | |
| if [[ "$CURRENT_BRANCH" != "$EXPECTED_BRANCH" ]]; then | |
| echo "❌ Branch validation failed!" | |
| echo "Current branch: $CURRENT_BRANCH" | |
| echo "Expected branch for $RELEASE_TYPE release: $EXPECTED_BRANCH" | |
| echo "For manual runs, choose the correct branch in 'Use workflow from'." | |
| exit 1 | |
| fi | |
| echo "✅ Manual branch validation passed" | |
| - name: Publish stable release | |
| if: steps.release-type.outputs.type == 'stable' | |
| run: npm publish | |
| - name: Publish beta release | |
| if: steps.release-type.outputs.type == 'beta' | |
| run: npm publish --tag beta |