|
| 1 | +name: 'Manual SDK Release' |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version-type: |
| 7 | + description: 'Version increment type' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - 'patch' |
| 12 | + - 'minor' |
| 13 | + - 'major' |
| 14 | + - 'custom' |
| 15 | + default: 'patch' |
| 16 | + custom-version: |
| 17 | + description: 'Custom version (e.g., 1.3.4, 2.1.0) - only used when version-type is "custom"' |
| 18 | + required: false |
| 19 | + type: string |
| 20 | + default: '' |
| 21 | + ref: |
| 22 | + description: 'Branch to build from' |
| 23 | + required: false |
| 24 | + type: string |
| 25 | + default: 'main' |
| 26 | + |
| 27 | +jobs: |
| 28 | + release-sdks: |
| 29 | + name: 'Release SDK Packages' |
| 30 | + runs-on: ubuntu-latest |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: 'Validate inputs' |
| 34 | + run: | |
| 35 | + echo "::group::Input validation" |
| 36 | + echo "Version type: ${{ inputs.version-type }}" |
| 37 | + echo "Custom version: ${{ inputs.custom-version }}" |
| 38 | + echo "Branch: ${{ inputs.ref }}" |
| 39 | + |
| 40 | + # Validate that custom-version is provided when version-type is custom |
| 41 | + if [ "${{ inputs.version-type }}" = "custom" ]; then |
| 42 | + if [ -z "${{ inputs.custom-version }}" ]; then |
| 43 | + echo "::error::Custom version must be provided when version-type is 'custom'" |
| 44 | + echo "Please provide a valid semantic version (e.g., 1.3.4, 2.0.0, 1.2.1)" |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + |
| 48 | + # Basic semver validation |
| 49 | + if [[ ! "${{ inputs.custom-version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 50 | + echo "::error::Invalid custom version format: '${{ inputs.custom-version }}'" |
| 51 | + echo "Version must follow semantic versioning format: major.minor.patch (e.g., 1.3.4)" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + |
| 55 | + echo "✅ Custom version '${{ inputs.custom-version }}' is valid" |
| 56 | + fi |
| 57 | + echo "::endgroup::" |
| 58 | +
|
| 59 | + - name: 'Deploy JavaScript SDK' |
| 60 | + id: deploy-javascript-sdk |
| 61 | + uses: ./.github/actions/core-cicd/deployment/deploy-javascript-sdk |
| 62 | + with: |
| 63 | + ref: ${{ inputs.ref }} |
| 64 | + npm-token: ${{ secrets.NPM_TOKEN }} |
| 65 | + npm-package-tag: 'latest' |
| 66 | + version-type: ${{ inputs.version-type }} |
| 67 | + custom-version: ${{ inputs.custom-version }} |
| 68 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: 'Display results' |
| 71 | + if: always() |
| 72 | + run: | |
| 73 | + echo "::group::Release Summary" |
| 74 | + echo "Version type used: ${{ steps.deploy-javascript-sdk.outputs.version-type-used || inputs.version-type }}" |
| 75 | + echo "Published to latest: ${{ steps.deploy-javascript-sdk.outputs.published-latest || 'unknown' }}" |
| 76 | + echo "Published to next: ${{ steps.deploy-javascript-sdk.outputs.published-next || 'unknown' }}" |
| 77 | + echo "NPM package version: ${{ steps.deploy-javascript-sdk.outputs.npm-package-version || 'unknown' }}" |
| 78 | + echo "Next version: ${{ steps.deploy-javascript-sdk.outputs.npm-package-version-next || 'unknown' }}" |
| 79 | + echo "::endgroup::" |
0 commit comments