-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.67 KB
/
Copy pathrelease.yml
File metadata and controls
60 lines (51 loc) · 1.67 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
name: Release
# Triggered on `v*` tag push. Maintainer's release ritual:
# bump VERSION → update CHANGELOG → commit → `git tag vX.Y.Z` → push --tags
#
# Publishes to RubyGems via a long-lived API key stored in
# secrets.RUBYGEMS_API_KEY. Trusted publishing (OIDC) is the longer-term
# direction (see https://guides.rubygems.org/trusted-publishing/) but the
# API-key path is fine for v0.1.x.
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Test
run: bundle exec rspec
- name: Build gem
run: gem build timeprice.gemspec
- name: Assert gem size <5MB
run: |
size=$(stat -c%s timeprice-*.gem)
echo "gem size: ${size} bytes"
test "$size" -lt 5242880
- name: Push to RubyGems
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: gem push timeprice-*.gem
- name: Extract CHANGELOG section for this tag
id: notes
run: |
VERSION="${GITHUB_REF_NAME#v}"
awk -v ver="$VERSION" '
$0 ~ "^## \\[" ver "\\]" { flag=1; next }
flag && /^## \[/ { exit }
flag { print }
' CHANGELOG.md > /tmp/release_notes.md
test -s /tmp/release_notes.md || echo "Release ${GITHUB_REF_NAME}" > /tmp/release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
body_path: /tmp/release_notes.md
files: timeprice-*.gem