-
Notifications
You must be signed in to change notification settings - Fork 2
127 lines (110 loc) · 3.43 KB
/
Copy pathrelease.yml
File metadata and controls
127 lines (110 loc) · 3.43 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
name: Release
on:
push:
tags:
- v**
workflow_dispatch:
permissions:
contents: read
jobs:
version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify version matches tag
if: github.ref_type == 'tag'
run: |
version=$(grep -oP "VERSION\s*=\s*'\\K[^']+" lib/restate/version.rb)
tag_version=${{ github.ref_name }}
tag_version=${tag_version#v}
if [ "${tag_version}" != "${version}" ]; then
echo "::error::version.rb version '${version}' != tag version '${tag_version}'. Please align them."
exit 1
fi
cargo_version=$(grep -oP '^version\s*=\s*"\K[^"]+' ext/restate_internal/Cargo.toml)
if [ "${tag_version}" != "${cargo_version}" ]; then
echo "::error::Cargo.toml version '${cargo_version}' != tag version '${tag_version}'. Please align them."
exit 1
fi
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: |
exclude:
- arm-linux
- x64-mingw32
- x64-mingw-ucrt
- aarch64-mingw-ucrt
native-gem:
name: Build native gem (${{ matrix.ruby-platform }})
runs-on: ubuntu-latest
needs: [version-check, ci-data]
strategy:
fail-fast: false
matrix:
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.3"
bundler-cache: true
cargo-cache: true
cache-version: v1
- name: Cross-compile gem
run: bundle exec rb-sys-dock --platform ${{ matrix.ruby-platform }} --ruby-versions "${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}" --mount-toolchains --build
- name: Upload gem
uses: actions/upload-artifact@v4
with:
name: gem-${{ matrix.ruby-platform }}
path: pkg/*-${{ matrix.ruby-platform }}.gem
if-no-files-found: error
source-gem:
runs-on: ubuntu-latest
needs: [version-check]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Build source gem
run: gem build restate-sdk.gemspec
- name: Upload gem
uses: actions/upload-artifact@v4
with:
name: gem-source
path: "*.gem"
if-no-files-found: error
release:
name: Publish to RubyGems
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [native-gem, source-gem]
environment: rubygems
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: gem-*
merge-multiple: true
path: gems/
- name: List gems
run: ls -la gems/
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Configure trusted publisher credentials
uses: rubygems/configure-rubygems-credentials@v1.0.0
- name: Publish to RubyGems
run: |
for gem in gems/*.gem; do
echo "Publishing ${gem}..."
gem push "${gem}"
done