|
3 | 3 | push: |
4 | 4 | tags: |
5 | 5 | - "[0-9]*.[0-9]*.[0-9]*" |
| 6 | + - "v[0-9]*.[0-9]*.[0-9]*" |
6 | 7 |
|
7 | 8 | jobs: |
8 | | - build_gem: |
| 9 | + build_source_gem: |
9 | 10 | name: Build source gem |
10 | 11 | runs-on: ubuntu-latest |
11 | 12 | steps: |
12 | | - - uses: actions/checkout@v4 |
13 | | - - uses: ruby/setup-ruby-pkgs@v1 |
| 13 | + - uses: actions/checkout@v6.0.2 |
| 14 | + - uses: ruby/setup-ruby@v1 |
14 | 15 | with: |
15 | 16 | ruby-version: 3.4 |
16 | | - - run: sudo apt-get update |
17 | | - - run: gem update --system |
18 | | - - run: rake gem |
| 17 | + bundler-cache: true |
| 18 | + - run: bundle exec rake build |
19 | 19 | - name: Upload source gem |
20 | | - uses: actions/upload-artifact@v4 |
| 20 | + uses: actions/upload-artifact@v7.0.0 |
21 | 21 | with: |
22 | | - name: distributing_iterator.gem |
| 22 | + name: source-gem |
23 | 23 | path: pkg/*.gem |
24 | 24 | retention-days: 1 |
25 | 25 |
|
26 | | - compile_native_gems: |
27 | | - name: Compile native gem |
28 | | - needs: build_gem |
| 26 | + build_native_gems: |
| 27 | + name: Build native gem (${{ matrix.platform }}) |
| 28 | + runs-on: ubuntu-latest |
29 | 29 | strategy: |
| 30 | + fail-fast: false |
30 | 31 | matrix: |
31 | | - include: |
32 | | - - os: ubuntu-24.04 |
33 | | - platform: x86_64-linux |
34 | | - ruby: "3.4" |
35 | | - - os: ubuntu-24.04-arm |
36 | | - platform: aarch64-linux |
37 | | - ruby: "3.4" |
38 | | - - os: macos-latest |
39 | | - platform: arm64-darwin |
40 | | - ruby: "3.4" |
41 | | - runs-on: ${{ matrix.os }} |
| 32 | + platform: |
| 33 | + - x86_64-linux |
| 34 | + - aarch64-linux |
| 35 | + - x86_64-darwin |
| 36 | + - arm64-darwin |
| 37 | + - x64-mingw-ucrt |
42 | 38 | steps: |
43 | | - - uses: actions/checkout@v4 |
44 | | - |
45 | | - - uses: ruby/setup-ruby-pkgs@v1 |
| 39 | + |
| 40 | + - uses: ruby/setup-ruby@v1 |
46 | 41 | with: |
47 | | - ruby-version: ${{ matrix.ruby }} |
48 | | - |
49 | | - - name: Install gem-compiler |
50 | | - run: gem install gem-compiler |
51 | | - |
52 | | - - name: Download source gem |
53 | | - uses: actions/download-artifact@v4 |
54 | | - with: |
55 | | - name: distributing_iterator.gem |
56 | | - path: pkg/ |
57 | | - |
58 | | - - name: Compile gem |
59 | | - run: | |
60 | | - SOURCE_GEM=$(ls pkg/*.gem | grep -v -- '-x86_64-linux\|aarch64-linux\|arm64-darwin') |
61 | | - gem compile $SOURCE_GEM --prune |
62 | | -
|
63 | | - - name: Upload compiled gem |
64 | | - uses: actions/upload-artifact@v4 |
| 42 | + ruby-version: 3.4 |
| 43 | + bundler-cache: true |
| 44 | + - name: Build native gems |
| 45 | + run: bundle exec rb-sys-dock --platform ${{ matrix.platform }} --build |
| 46 | + - name: Upload native gems |
| 47 | + |
65 | 48 | with: |
66 | | - name: distributing_iterator-${{ matrix.platform }}.gem |
67 | | - path: ./*.gem |
| 49 | + name: native-gem-${{ matrix.platform }} |
| 50 | + path: pkg/*-${{ matrix.platform }}.gem |
68 | 51 | retention-days: 1 |
69 | 52 |
|
70 | 53 | release: |
71 | 54 | name: Create GitHub Release |
72 | | - needs: compile_native_gems |
| 55 | + needs: |
| 56 | + - build_source_gem |
| 57 | + - build_native_gems |
73 | 58 | runs-on: ubuntu-latest |
| 59 | + permissions: |
| 60 | + contents: write |
74 | 61 | steps: |
75 | | - - uses: actions/checkout@v4 |
76 | | - |
77 | 62 | - name: Extract version |
78 | 63 | id: extract_version |
79 | 64 | run: | |
80 | 65 | VERSION=${GITHUB_REF#refs/tags/} |
| 66 | + VERSION=${VERSION#v} |
81 | 67 | echo "GEM_VERSION=$VERSION" >> $GITHUB_ENV |
82 | 68 |
|
83 | 69 | - name: Download all artifacts |
84 | | - uses: actions/download-artifact@v4 |
| 70 | + uses: actions/download-artifact@v8.0.1 |
85 | 71 | with: |
86 | 72 | path: artifacts |
87 | 73 |
|
88 | | - - name: Rename gem files with version |
89 | | - run: | |
90 | | - mkdir -p release_gems |
91 | | - for gem in artifacts/distributing_iterator-*.gem/*.gem; do |
92 | | - # Extract platform from the original filename |
93 | | - platform=$(basename $gem | sed -E 's/distributing_iterator-([^-]+-[^-]+)\.gem/\1/') |
94 | | - |
95 | | -
|
96 | | - target_filename="distributing_iterator-${GEM_VERSION}-${platform}.gem" |
97 | | - target_path="release_gems/$target_filename" |
98 | | - mv "$gem" "$target_path" |
99 | | - done |
100 | | - # Move source gem to release_gems directory |
101 | | - mv artifacts/distributing_iterator.gem/*.gem release_gems/distributing_iterator-${GEM_VERSION}.gem |
102 | | -
|
103 | 74 | - name: Create release |
104 | 75 | uses: softprops/action-gh-release@v2 |
105 | 76 | with: |
106 | | - tag_name: ${{ env.GEM_VERSION }} |
107 | | - files: release_gems/*.gem |
| 77 | + tag_name: ${{ github.ref_name }} |
| 78 | + name: distributing_iterator ${{ env.GEM_VERSION }} |
| 79 | + files: artifacts/**/*.gem |
108 | 80 | generate_release_notes: true |
0 commit comments