-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.02 KB
/
release.yml
File metadata and controls
42 lines (35 loc) · 1.02 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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
environment:
name: rubygems
url: https://rubygems.org/gems/postio
permissions:
contents: write # rubygems/release-gem creates a GH release
id-token: write # Trusted Publishers (OIDC)
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Verify tag matches gem version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG="${GITHUB_REF#refs/tags/v}"
VERSION=$(ruby -r ./lib/postio/version -e "puts Postio::VERSION")
if [ "$TAG" != "$VERSION" ]; then
echo "::error::Tag v$TAG does not match Postio::VERSION $VERSION"
exit 1
fi
- name: Run offline tests
run: bundle exec rspec
- name: Release gem (Trusted Publishers)
uses: rubygems/release-gem@v1