-
Notifications
You must be signed in to change notification settings - Fork 34
124 lines (113 loc) · 3.09 KB
/
release-crate-gem.yml
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
name: "Release Crate & RubyGem"
on:
push:
tags:
- "v*"
branches:
- release-gem
jobs:
publish_crate:
name: Publish Crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/cargo@v1
if: startsWith(github.ref, 'refs/tags/v')
name: Release Crate
with:
command: publish
args: --manifest-path autocorrect/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
build:
needs:
- publish_crate
name: Build compile gems
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-platform:
- arm64-darwin
- x86_64-darwin
- x86_64-linux
- aarch64-linux
- x86_64-linux-musl
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1.1.9
with:
ruby-version: "3.3"
bundler-cache: true
cargo-cache: true
cargo-vendor: false
- name: Touch Rakefile
run: |
touch Rakefile
- uses: oxidize-rb/actions/cross-gem@v1.1.9
with:
platform: ${{ matrix.ruby-platform }}
working-directory: autocorrect-rb/
ruby-versions: "3.3, 3.2, 3.1" # optional
- name: Upload Gem
uses: actions/upload-artifact@v3
with:
name: cross-gem
path: autocorrect-rb/pkg/
build_source:
name: Build source gem
needs:
- publish_crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1.1.9
with:
ruby-version: "3.3"
bundler-cache: false
cargo-cache: true
cargo-vendor: true
- name: Build gem
run: |
cd autocorrect-rb/
gem build autocorrect-rb.gemspec
mkdir -p pkg/
mv *.gem pkg/
- name: Upload Gem
uses: actions/upload-artifact@v3
with:
name: cross-gem
path: autocorrect-rb/pkg/
publish:
name: Publish cross gems
runs-on: ubuntu-latest
needs:
- build
- build_source
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- uses: actions/download-artifact@v3
with:
name: cross-gem
path: pkg/
- name: Display structure of built gems
run: ls -R
working-directory: pkg/
- name: Publish to RubyGem
env:
RUBYGEM_TOKEN: "${{secrets.RUBYGEM_TOKEN}}"
working-directory: pkg/
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEM_TOKEN}\n" > $HOME/.gem/credentials
for filename in *.gem; do
echo $filename
gem push $filename
done
- name: Install RubyGem & Test Run
run: |
gem install autocorrect-rb --verbose
ruby -e "require 'autocorrect-rb'; puts AutoCorrect.format('Hello你好.');"