chore(release): v0.0.44 #1
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # v0.1.0, v1.0.0 등 | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| # 테스트 먼저 실행 | |
| test: | |
| name: Pre-release Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| - name: Run tests | |
| run: bundle exec rspec | |
| - name: Run linter | |
| run: bundle exec rubocop | |
| # RubyGems 배포 | |
| publish-gem: | |
| name: Publish to RubyGems | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing version: $VERSION" | |
| - name: Verify version matches | |
| run: | | |
| GEM_VERSION=$(ruby -r ./lib/t_ruby/version -e 'puts TRuby::VERSION') | |
| TAG_VERSION=${{ steps.version.outputs.version }} | |
| if [[ "$GEM_VERSION" != "$TAG_VERSION" ]]; then | |
| echo "Version mismatch: gem=$GEM_VERSION, tag=$TAG_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version verified: $GEM_VERSION" | |
| - name: Build gem | |
| run: gem build t_ruby.gemspec | |
| - name: Publish to RubyGems | |
| run: | | |
| mkdir -p ~/.gem | |
| echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials | |
| chmod 0600 ~/.gem/credentials | |
| gem push t-ruby-${{ steps.version.outputs.version }}.gem | |
| - name: Upload gem artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gem | |
| path: '*.gem' | |
| # npm WASM 패키지 배포 | |
| publish-wasm: | |
| name: Publish WASM to npm | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| - name: Install dependencies | |
| run: | | |
| cd wasm | |
| npm install | |
| - name: Build WASM package | |
| run: | | |
| cd wasm | |
| bash ./build.sh | |
| - name: Sync version from git tag | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "Version: $VERSION" | |
| cd wasm | |
| npm version $VERSION --no-git-tag-version --allow-same-version | |
| - name: Publish to npm | |
| run: | | |
| cd wasm | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Upload WASM artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm | |
| path: wasm/dist/* | |
| # GitHub Release 생성 | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [publish-gem, publish-wasm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| # Get previous tag | |
| PREV_TAG=$(git describe --abbrev=0 --tags HEAD^ 2>/dev/null || echo "") | |
| CURRENT_TAG=${GITHUB_REF#refs/tags/} | |
| echo "## What's Changed" > CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| if [[ -n "$PREV_TAG" ]]; then | |
| # Get commits between tags | |
| git log --pretty=format:"* %s (%h)" $PREV_TAG..$CURRENT_TAG >> CHANGELOG.md | |
| else | |
| # First release - get all commits | |
| git log --pretty=format:"* %s (%h)" >> CHANGELOG.md | |
| fi | |
| echo "" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...$CURRENT_TAG" >> CHANGELOG.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: CHANGELOG.md | |
| files: | | |
| artifacts/gem/*.gem | |
| artifacts/wasm/* | |
| fail_on_unmatched_files: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |