Repository navigation
137 lines (119 loc) · 4.4 KB
/
Copy pathruby-release.yml
File metadata and controls
137 lines (119 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Ruby Release
on:
push:
tags:
- ruby-v*
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci-data:
runs-on: ubuntu-24.04
outputs:
supported-ruby-platforms: ${{ steps.parse.outputs.supported-ruby-platforms }}
stable-ruby-versions: ${{ steps.parse.outputs.stable-ruby-versions }}
steps:
- id: fetch
uses: oxidize-rb/actions/fetch-ci-data@ec90b4aa48795518d79be3f5cc478d1d7ccd02a8 # v1.5.0
with:
supported-ruby-platforms: |
exclude:
- arm-linux
# `magnus` initializes `libc::timespec` without the padding field that
# 32-bit musl targets carry with 64-bit `time_t`, so the extension does
# not compile for this platform.
- arm-linux-musl
- x64-mingw32
- aarch64-mingw-ucrt
stable-ruby-versions: |
exclude:
- head
- id: parse
run: |
echo "supported-ruby-platforms=$(echo '${{ steps.fetch.outputs.result }}' | jq -c '."supported-ruby-platforms"')" >> "$GITHUB_OUTPUT"
echo "stable-ruby-versions=$(echo '${{ steps.fetch.outputs.result }}' | jq -r '."stable-ruby-versions" | join(",")')" >> "$GITHUB_OUTPUT"
build:
name: Build (${{ matrix.platform }})
runs-on: ubuntu-24.04
needs: ci-data
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.ci-data.outputs.supported-ruby-platforms) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1.345.0
with:
ruby-version: "3.4"
- name: Expose Gemfile.lock for rb-sys-dock version detection
run: cp crates/jsonschema-rb/Gemfile.lock Gemfile.lock
- uses: oxidize-rb/actions/cross-gem@ec90b4aa48795518d79be3f5cc478d1d7ccd02a8 # v1.5.0
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: ${{ needs.ci-data.outputs.stable-ruby-versions }}
working-directory: crates/jsonschema-rb
- name: Smoke test (x86_64-linux only)
if: matrix.platform == 'x86_64-linux'
run: |
gem install pkg/*.gem --local
ruby -e "require 'jsonschema_rs'; raise 'validation failed' unless JSONSchema.valid?({'type'=>'string'}, 'hello'); puts 'smoke test OK'"
working-directory: crates/jsonschema-rb
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: gem-${{ matrix.platform }}
path: crates/jsonschema-rb/pkg/*.gem
if-no-files-found: error
release:
name: Release
runs-on: ubuntu-24.04
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1.345.0
with:
ruby-version: "3.4"
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: artifacts
pattern: gem-*
- name: Build source gem
run: gem build jsonschema.gemspec
working-directory: crates/jsonschema-rb
- name: Collect all gems
run: |
mkdir -p pkg
mv artifacts/**/*.gem pkg/
mv crates/jsonschema-rb/jsonschema_rs-*.gem pkg/
- name: Push to RubyGems
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem
echo "---" > ~/.gem/credentials
echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> ~/.gem/credentials
chmod 0600 ~/.gem/credentials
for gem in pkg/*.gem; do
echo "Pushing ${gem}..."
gem push "${gem}"
done
- name: Extract Version
run: echo "version=${GITHUB_REF#refs/tags/ruby-v}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4
with:
files: pkg/*.gem
make_latest: false
draft: true
name: "[Ruby] Release ${{ env.version }}"