Release #14
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: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - 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과 동일하게 설정 | |
| if [[ -z "$T_RUBY_VERSION" ]]; then | |
| T_RUBY_VERSION="$VERSION" | |
| 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: 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: | |
| name: "v${{ steps.version.outputs.version }}" | |
| generate_release_notes: true | |
| files: | | |
| dist/* | |
| package.json |