Skip to content

Commit 670d3cc

Browse files
author
Jon Elverkilde
committed
Add release actions, bump Ruby versions
1 parent 8fbddc2 commit 670d3cc

10 files changed

+139
-9
lines changed

.document

-5
This file was deleted.

.gemtest

Whitespace-only changes.

.github/stale.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Configuration for probot-stale - https://github.com/probot/stale
22

33
# Number of days of inactivity before an Issue or Pull Request becomes stale
4-
daysUntilStale: 365
4+
daysUntilStale: 90
55

66
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
77
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
@@ -23,4 +23,4 @@ markComment: >
2323
This issue has been automatically marked as stale because it has not had
2424
recent activity. It will be closed if no further activity occurs. If you'd
2525
like this issue to stay open please leave a comment indicating how this issue
26-
is affecting you. Thankyou.
26+
is affecting you. Thank you.

.github/workflows/gh-release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Github Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
create-release:
9+
name: Create Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Setup git
15+
run: |
16+
git config user.email "pusher-ci@pusher.com"
17+
git config user.name "Pusher CI"
18+
- name: Prepare description
19+
run: |
20+
csplit -s CHANGELOG.md "/##/" {1}
21+
cat xx01 > CHANGELOG.tmp
22+
- name: Prepare tag
23+
run: |
24+
export TAG=$(head -1 CHANGELOG.tmp | cut -d' ' -f2)
25+
echo "TAG=$TAG" >> $GITHUB_ENV
26+
- name: Create Release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ env.TAG }}
32+
release_name: ${{ env.TAG }}
33+
body_path: CHANGELOG.tmp
34+
draft: false
35+
prerelease: false

.github/workflows/publish.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: RubyGems release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
14+
- name: Publish gem
15+
uses: dawidd6/action-publish-gem@v1
16+
with:
17+
api_key: ${{secrets.RUBYGEMS_API_KEY}}

.github/workflows/release.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [ labeled ]
6+
branches:
7+
- master
8+
9+
jobs:
10+
prepare-release:
11+
name: Prepare release
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set major release
16+
if: ${{ github.event.label.name == 'release-major' }}
17+
run: echo "RELEASE=major" >> $GITHUB_ENV
18+
- name: Set minor release
19+
if: ${{ github.event.label.name == 'release-minor' }}
20+
run: echo "RELEASE=minor" >> $GITHUB_ENV
21+
- name: Set patch release
22+
if: ${{ github.event.label.name == 'release-patch' }}
23+
run: echo "RELEASE=patch" >> $GITHUB_ENV
24+
- name: Check release env
25+
run: |
26+
if [[ -z "${{ env.RELEASE }}" ]];
27+
then
28+
echo "You need to set a release label on PRs to the main branch"
29+
exit 1
30+
else
31+
exit 0
32+
fi
33+
- name: Install semver-tool
34+
run: |
35+
export DIR=$(mktemp -d)
36+
cd $DIR
37+
curl https://github.com/fsaintjacques/semver-tool/archive/3.2.0.tar.gz -L -o semver.tar.gz
38+
tar -xvf semver.tar.gz
39+
sudo cp semver-tool-3.2.0/src/semver /usr/local/bin
40+
- name: Bump version
41+
run: |
42+
export CURRENT=$(gem info pusher-push-notifications --remote --exact | grep -o "pusher-push-notifications ([0-9]*\.[0-9]*\.[0-9]*)" | awk -F '[()]' '{print $2}')
43+
export NEW_VERSION=$(semver bump ${{ env.RELEASE }} $CURRENT)
44+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
45+
- name: Checkout code
46+
uses: actions/checkout@v2
47+
- name: Setup git
48+
run: |
49+
git config user.email "pusher-ci@pusher.com"
50+
git config user.name "Pusher CI"
51+
git fetch
52+
git checkout ${{ github.event.pull_request.head.ref }}
53+
- name: Prepare CHANGELOG
54+
run: |
55+
echo "${{ github.event.pull_request.body }}" | csplit -s - "/##/"
56+
echo "# Changelog
57+
58+
## ${{ env.VERSION }}
59+
" >> CHANGELOG.tmp
60+
grep "^*" xx01 >> CHANGELOG.tmp
61+
grep -v "^# " CHANGELOG.md >> CHANGELOG.tmp
62+
cp CHANGELOG.tmp CHANGELOG.md
63+
- name: Prepare version.rb
64+
run: |
65+
sed -i "s|VERSION = '[^']*'|VERSION = '${{ env.VERSION }}'|" lib/pusher/version.rb
66+
- name: Prepare Gemfile.lock
67+
run: |
68+
sed -i "s|pusher-push-notifications ([^)]*)|pusher-push-notifications (${{ env.VERSION }})|" Gemfile.lock
69+
- name: Commit changes
70+
run: |
71+
git add CHANGELOG.md lib/pusher/push_notifications/version.rb Gemfile.lock
72+
git commit -m "Bump to version ${{ env.VERSION }}"
73+
- name: Push
74+
run: git push

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
ruby: [ '2.4', '2.5', '2.6' ]
14+
ruby: ['2.6', '2.7', '3.0']
1515

1616
name: Ruby ${{ matrix.ruby }} Test
1717

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This Gem provides a Ruby interface to [the Pusher HTTP API for Pusher Channels](
66

77
## Supported Platforms
88

9-
* Ruby - supports **Ruby 2.4 or greater**.
9+
* Ruby - supports **Ruby 2.6 or greater**.
1010

1111
## Installation and Configuration
1212

pull_request_template.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Description
2+
3+
Add a short description of the change. If this is related to an issue, please add a reference to the issue.
4+
5+
## CHANGELOG
6+
7+
* [CHANGED] Describe your change here. Look at CHANGELOG.md to see the format.

pusher.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Gem::Specification.new do |s|
1313
s.description = %q{Wrapper for Pusher Channels REST api: : https://pusher.com/channels}
1414
s.license = "MIT"
1515

16+
s.required_ruby_version = ">= 2.6"
17+
1618
s.add_dependency "multi_json", "~> 1.15"
1719
s.add_dependency 'pusher-signature', "~> 0.1.8"
1820
s.add_dependency "httpclient", "~> 2.8"

0 commit comments

Comments
 (0)