-
Notifications
You must be signed in to change notification settings - Fork 20
130 lines (115 loc) · 3.9 KB
/
release.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
125
126
127
128
129
130
---
name: Release
on:
workflow_dispatch:
push:
tags: ["v*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- id: fetch
uses: oxidize-rb/actions/fetch-ci-data@v1
with:
supported-ruby-platforms: |
# Excluding:
# `arm-linux`: Cranelift doesn't support 32-bit architectures
# `x64-mingw32`: `x64-mingw-ucrt` should be used for Ruby 3.1+ (https://github.com/rake-compiler/rake-compiler-dock?tab=readme-ov-file#windows)
# 3.0 is deprecated as stable ruby version according to:
# https://github.com/oxidize-rb/actions/blob/main/fetch-ci-data/evaluate.rb#L54
exclude: [arm-linux, x64-mingw32]
stable-ruby-versions: |
exclude: [head]
build:
name: Build native gems
needs: ci-data
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.ruby-platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}
- uses: actions/upload-artifact@v4
with:
name: cross-gem-${{ matrix.ruby-platform }}
path: pkg/*-${{ matrix.ruby-platform }}.gem
if-no-files-found: error
- name: Smoke gem install
if: matrix.ruby-platform == 'x86_64-linux' # GitHub actions architecture
run: |
gem install pkg/wasmtime-*.gem --verbose
script="puts Wasmtime::Engine.new.precompile_module('(module)')"
ruby -rwasmtime -e "$script" | grep wasmtime.info
echo "✅ Successfully gem installed"
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.4"
bundler-cache: true
cargo-cache: true
cache-version: v1
- uses: actions/download-artifact@v4
with:
pattern: cross-gem-*
merge-multiple: true
path: pkg/
- name: Package source gem
run: bundle exec rake pkg:ruby
- name: Ensure version matches the tag
run: |
GEM_VERSION=$(grep VERSION lib/wasmtime/version.rb | head -n 1 | cut -d'"' -f2)
if [ "v$GEM_VERSION" != "${{ github.ref_name }}" ]; then
echo "Gem version does not match tag"
echo " v$GEM_VERSION != ${{ github.ref_name }}"
exit 1
fi
- name: Push Gem
working-directory: pkg/
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_KEY }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
ls -l
for i in *.gem; do
if [ -f "$i" ]; then
if ! gem push "$i" >push.out; then
gemerr=$?
sed 's/^/::error:: /' push.out
if ! grep -q "Repushing of gem" push.out; then
exit $gemerr
fi
fi
fi
done
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
draft: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
skipIfReleaseExists: true