Release #25
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'WASM version (e.g., 0.0.46.1)' | |
| required: true | |
| t_ruby_version: | |
| description: 't-ruby version (e.g., 0.0.46, defaults to latest)' | |
| required: false | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Upgrade npm for OIDC trusted publishing | |
| run: | | |
| npm install -g npm@latest | |
| npm --version | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Extract version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| VERSION="${{ inputs.version }}" | |
| T_RUBY_VERSION="${{ inputs.t_ruby_version }}" | |
| else | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| T_RUBY_VERSION="" | |
| fi | |
| # t_ruby_version이 없으면 version에서 베이스 버전 추출 | |
| # 예: 0.0.46-patch1 -> 0.0.46 | |
| if [[ -z "$T_RUBY_VERSION" ]]; then | |
| T_RUBY_VERSION=$(echo "$VERSION" | sed 's/-patch[0-9]*$//') | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "t_ruby_version=$T_RUBY_VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing version: $VERSION (t-ruby: $T_RUBY_VERSION)" | |
| - name: Clone t-ruby source | |
| run: | | |
| git clone --depth 1 --branch v${{ steps.version.outputs.t_ruby_version }} \ | |
| https://github.com/type-ruby/t-ruby.git /tmp/t-ruby | |
| echo "Cloned t-ruby v${{ steps.version.outputs.t_ruby_version }}" | |
| - name: Copy t-ruby lib to vendor | |
| run: | | |
| mkdir -p vendor/t-ruby | |
| cp -r /tmp/t-ruby/lib/* vendor/t-ruby/ | |
| echo "Copied t-ruby lib files:" | |
| ls -la vendor/t-ruby/ | |
| - name: Bundle t-ruby source | |
| run: node scripts/bundle-t-ruby.mjs | |
| - name: Build | |
| run: npm run build | |
| - name: Verify build output | |
| run: | | |
| echo "Verifying build output..." | |
| ls -la dist/ | |
| test -f dist/index.js || (echo "ERROR: dist/index.js not found" && exit 1) | |
| test -f dist/index.cjs || (echo "ERROR: dist/index.cjs not found" && exit 1) | |
| test -f dist/index.d.ts || (echo "ERROR: dist/index.d.ts not found" && exit 1) | |
| echo "Build verification passed!" | |
| - name: Update version | |
| run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Publish to npm | |
| run: npm publish --access public --provenance | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ steps.version.outputs.version }}" | |
| name: "v${{ steps.version.outputs.version }}" | |
| generate_release_notes: true | |
| files: | | |
| dist/* | |
| package.json |