Skip to content

Commit c3c7d91

Browse files
authored
Automate release (#83)
* Automate release * Add PR template * Reformat Changelog.md
1 parent 87ed92a commit c3c7d91

File tree

4 files changed

+126
-32
lines changed

4 files changed

+126
-32
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## What does this PR do?
2+
3+
[Description here]
4+
5+
## CHANGELOG
6+
7+
- [CHANGED] Describe your change here. Look at CHANGELOG.md to see the format.

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
push:
3+
branches: [ master ]
4+
5+
jobs:
6+
check-release-tag:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
- name: Prepare tag
14+
id: prepare_tag
15+
continue-on-error: true
16+
run: |
17+
export TAG=v$(awk '/libraryVersion =/ { gsub("\"",""); print $3 }' client.go)
18+
echo "TAG=$TAG" >> $GITHUB_ENV
19+
20+
export CHECK_TAG=$(git tag | grep $TAG)
21+
if [[ $CHECK_TAG ]]; then
22+
echo "Skipping because release tag already exists"
23+
exit 1
24+
fi
25+
- name: Output
26+
id: release_output
27+
if: ${{ steps.prepare_tag.outcome == 'success' }}
28+
run: |
29+
echo "::set-output name=tag::${{ env.TAG }}"
30+
outputs:
31+
tag: ${{ steps.release_output.outputs.tag }}
32+
33+
create-github-release:
34+
runs-on: ubuntu-latest
35+
needs: check-release-tag
36+
if: ${{ needs.check-release-tag.outputs.tag }}
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Prepare tag
40+
run: |
41+
export TAG=v$(jq -r '.version' package.json)
42+
echo "TAG=$TAG" >> $GITHUB_ENV
43+
- name: Setup git
44+
run: |
45+
git config user.email "[email protected]"
46+
git config user.name "Pusher CI"
47+
- name: Prepare description
48+
run: |
49+
csplit -s CHANGELOG.md "/##/" {1}
50+
cat xx01 > CHANGELOG.tmp
51+
- name: Create Release
52+
uses: actions/create-release@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
tag_name: ${{ env.TAG }}
57+
release_name: ${{ env.TAG }}
58+
body_path: CHANGELOG.tmp
59+
draft: false
60+
prerelease: false

.github/workflows/release_pr.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Get current version
16+
shell: bash
17+
run: |
18+
CURRENT_VERSION=$(awk '/libraryVersion =/ { gsub("\"",""); print $3 }' client.go)
19+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
20+
- uses: actions/checkout@v2
21+
with:
22+
repository: pusher/public_actions
23+
path: .github/actions
24+
- uses: ./.github/actions/prepare-version-bump
25+
id: bump
26+
with:
27+
current_version: ${{ env.CURRENT_VERSION }}
28+
- name: Push
29+
shell: bash
30+
run: |
31+
sed -i'' -e 's/${{env.CURRENT_VERSION}}/${{steps.bump.outputs.new_version}}/' client.go
32+
33+
git add client.go CHANGELOG.md
34+
git commit -m "Bump to version ${{ steps.bump.outputs.new_version }}"
35+
git push

CHANGELOG.md

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
5.0.0 / 2021-02-19
2-
==================
1+
# Changelog
2+
3+
## 5.0.0 / 2021-02-19
4+
35
* Breaking change: `TriggerBatch` now returns `(*TriggerBatchChannelsList, error)` instead of `error`
46
* Breaking change: `Channels` takes `ChannelsParams` as a parameter instead of `map[string]string`
57
* Breaking change: `Channel` takes `ChannelParams` as a parameter instead of `map[string]string`
@@ -8,28 +10,28 @@
810
* Added a `Info` field to the `Event` type passed to `TriggerBatch`
911
* Deprecated `TriggerExclusive` and `TriggerMultiExclusive` (use `TriggerWithParams` and `TriggerMultiWithParams` instead)
1012

11-
4.0.4 / 2020-09-02
12-
==================
13+
## 4.0.4 / 2020-09-02
14+
1315
* Allow message size to be overridden for dedicate cluster customers (PR [#63](https://github.com/pusher/pusher-http-go/pull/71))
1416

15-
4.0.3 / 2020-07-28
16-
==================
17+
## 4.0.3 / 2020-07-28
18+
1719
* Added library name and version in HTTP Header (PR [#62](https://github.com/pusher/pusher-http-go/pull/62))
1820
* Changed: allow larger (10KB -> 20KB) requests as we sometimes do on dedicated clusters (PR [#66](https://github.com/pusher/pusher-http-go/pull/66))
1921

20-
4.0.2 / 2020-07-28
21-
==================
22+
## 4.0.2 / 2020-07-28
23+
2224
* Added `go.mod` for managing the library as a Go module
2325
* Changed `github.com/stretchr/testify/assert` with a stable `gopkg.in/stretchr/testify.v1/assert`
2426

25-
4.0.1 / 2020-04-01
26-
==================
27+
## 4.0.1 / 2020-04-01
28+
2729

2830
* Added EncryptionMasterKeyBase64 parameter
2931
* Deprecated EncryptionMasterKey parameter
3032

31-
4.0.0 / 2019-05-31
32-
==================
33+
## 4.0.0 / 2019-05-31
34+
3335
* This release modifies the entire repo to respect the go linter. This is a significant API breaking change and will likely require you to correct references to the names that were changed in your code. All future releases will respect the linter. A summary of the changes:
3436
* Rename AppId > AppID
3537
* Rename UserId > UserID
@@ -38,57 +40,47 @@
3840
* Rename HttpClient > HTTPClient
3941
* Improved comments and tabbing
4042

41-
3.0.0 / 2019-05-31
42-
==================
43+
## 3.0.0 / 2019-05-31
4344

4445
* This release removes the `*BufferedEvents` return from calls to `trigger` is it never did anything. Our documentation elsewhere conflicted with this, and it made the library more complex than it needed to be, so we removed it.
4546

46-
2.0.0 / 2019-05-31
47-
==================
47+
## 2.0.0 / 2019-05-31
4848

4949
* This release removes support for Push Notifications. Check out https://pusher.com/beams for our new, improved Push Notification offering!
5050

51-
1.3.0 / 2018-08-13
52-
==================
51+
## 1.3.0 / 2018-08-13
5352

5453
* This release adds support for end to end encrypted channels, a new feature for Channels. Read more [in our docs](https://pusher.com/docs/client_api_guide/client_encrypted_channels).
5554

56-
1.2.0 / 2016-05-24
57-
==================
55+
## 1.2.0 / 2016-05-24
5856

5957
* Add support for batch events
6058

61-
1.1.0 / 2016-02-22
62-
==================
59+
## 1.1.0 / 2016-02-22
6360

6461
* Introduce a `Cluster` option for the Pusher initializer.
6562

66-
1.0.0 / 2015-05-14
67-
==================
63+
## 1.0.0 / 2015-05-14
6864

6965
* Users can pass in a `http.Client` instance to the Pusher initializer. They can configure this instance directly to have specific options e.g. timeouts.
7066
* Therefore, the `Timeout` field on `pusher.Client` is deprecated.
7167
* `HttpClient()` function is no longer public. HTTP Client configuration is now done on the `HttpClient` **property** of `pusher.Client`. Read [here](https://github.com/pusher/pusher-http-go#request-timeouts) for more details.
7268
* If no `HttpClient` is specified, the library creates one with a default timeout of 5 seconds.
7369
* The library is now GAE compatible. Read [here](https://github.com/pusher/pusher-http-go#google-app-engine) for more details.
7470

75-
0.2.2 / 2015-05-12
76-
==================
71+
## 0.2.2 / 2015-05-12
7772

7873
* Socket_ids are now validated upon Trigger*Exclusive and channel authentication.
7974

80-
0.2.1 / 2015-04-30
81-
==================
75+
## 0.2.1 / 2015-04-30
8276

8377
* Webhook validation uses hmac.Equals to guard against timing attacks.
8478

85-
0.2.0 / 2015-03-30
86-
==================
79+
## 0.2.0 / 2015-03-30
8780

8881
* A HTTP client is shared between requests to allow configuration. If none is set by the user, the library supplies a default. Allows for pipelining or to change the transport.
8982

90-
0.1.0 / 2015-03-26
91-
==================
83+
## 0.1.0 / 2015-03-26
9284

9385
* Instantiation of client from credentials, URL or environment variables.
9486
* User can trigger Pusher events on single channels, multiple channels, and exclude recipients

0 commit comments

Comments
 (0)