Skip to content

Commit cc51136

Browse files
ci: switch to release please and deprecate github pat (#649)
Co-authored-by: Kevin Webster <[email protected]>
1 parent 76cddb7 commit cc51136

File tree

6 files changed

+71
-43
lines changed

6 files changed

+71
-43
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check PR Title
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
types: [opened, edited, synchronize, reopened]
7+
8+
jobs:
9+
commitlint:
10+
name: Check PR title
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup Node.js
14+
uses: actions/setup-node@v6
15+
with:
16+
node-version: '20.x'
17+
18+
- name: Setup
19+
run: |
20+
npm install -g @commitlint/cli @commitlint/config-conventional
21+
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
22+
23+
- name: Verify PR title is in the correct format
24+
env:
25+
TITLE: ${{ github.event.pull_request.title }}
26+
run: |
27+
echo "$TITLE" | npx commitlint -V

.github/workflows/elixir.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
otp: '27.0'
2929
- pair:
3030
elixir: '1.18'
31-
otp: '28.0'
31+
otp: '28.1'
3232
lint: lint
3333

3434
runs-on: ubuntu-22.04

.github/workflows/publish.yml

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,59 @@
11
name: Publish New Release
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
version:
6-
type: choice
7-
description: What version to publish?
8-
options:
9-
- patch
10-
- minor
11-
- major
12-
changes:
13-
description: Specify an entry for the changelog
14-
required: true
3+
push:
4+
branches:
5+
- master
6+
7+
permissions:
8+
contents: write
9+
issues: write
10+
pull-requests: write
11+
repository-projects: read # this is required by release-please-action to set the auto-release tags
12+
13+
# Note for release-please-action:
14+
# The action will set the auto-release tags for the release PR. If these tags do not already exist, the action will fail to create them.
15+
# Therefore, make sure that the tags are created in the repository before running the release workflow: `autorelease: pending`, `autorelease: tagged`
1516

1617
jobs:
1718
ci:
1819
uses: ./.github/workflows/elixir.yml
1920
secrets: inherit
2021

21-
publish:
22+
release-please:
23+
runs-on: ubuntu-latest
2224
needs: [ci]
23-
name: Build and publish to hex.pm
24-
runs-on: ubuntu-22.04
25-
env:
26-
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
2725
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v5
26+
- uses: googleapis/release-please-action@v4
27+
id: release
3028
with:
31-
token: ${{ secrets.GH_PUBLISH_PAT }}
32-
fetch-depth: 0
33-
ref: master
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
release-type: elixir
3431

35-
- name: Git Config
36-
run: |
37-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
38-
git config --global user.name "github-actions[bot]"
32+
# The logic below handles Hex.pm publishing.
33+
- uses: actions/checkout@v5
34+
if: ${{ steps.release.outputs.release_created }}
3935

40-
- name: Setup Elixir
41-
uses: erlef/setup-elixir@v1
36+
- name: Set up Elixir
37+
if: ${{ steps.release.outputs.release_created }}
38+
uses: erlef/setup-beam@v1
4239
with:
43-
otp-version: '24.3'
4440
elixir-version: '1.15'
41+
otp-version: '26'
4542

4643
- name: Restore dependencies cache
44+
if: ${{ steps.release.outputs.release_created }}
4745
uses: actions/cache@v4
4846
with:
4947
path: deps
5048
key: ${{ runner.os }}-publish-mix-${{ hashFiles('**/mix.lock') }}
5149
restore-keys: ${{ runner.os }}-publish-mix-
5250

53-
- name: Install deps
51+
- name: Install dependencies
52+
if: ${{ steps.release.outputs.release_created }}
5453
run: mix deps.get
5554

56-
- name: Add changelog entry
57-
run: echo "${{ inputs.changes }}" > RELEASE.md
58-
59-
- name: Bump version, generate changelog, push to git, publish on hex.pm
60-
run: mix expublish.${{ inputs.version }} --disable-test
61-
62-
55+
- name: Publish to Hex.pm
56+
if: ${{ steps.release.outputs.release_created }}
57+
run: mix hex.publish --yes
58+
env:
59+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}

mix.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ defmodule Honeybadger.Mixfile do
113113
# Dev dependencies
114114
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
115115
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
116-
{:expublish, "~> 2.5", only: [:dev], runtime: false},
117116

118117
# Test dependencies
119118
{:plug_cowboy, ">= 2.0.0 and < 3.0.0", only: :test},

mix.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"ecto": {:hex, :ecto, "3.12.2", "bae2094f038e9664ce5f089e5f3b6132a535d8b018bd280a485c2f33df5c0ce1", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "492e67c70f3a71c6afe80d946d3ced52ecc57c53c9829791bfff1830ff5a1f0c"},
1111
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
1212
"ex_doc": {:hex, :ex_doc, "0.37.1", "65ca30d242082b95aa852b3b73c9d9914279fff56db5dc7b3859be5504417980", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "6774f75477733ea88ce861476db031f9399c110640752ca2b400dbbb50491224"},
13-
"expublish": {:hex, :expublish, "2.7.5", "684e20f6538019b2f563f957181ec94176a0fe8de6cba552c6d8471158354701", [:mix], [], "hexpm", "25ca84eb8fe7e17e6baa250f0cca27cabdd6b7d49584ffd13bb541471857df79"},
1413
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
1514
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~>2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
1615
"hpax": {:hex, :hpax, "1.0.2", "762df951b0c399ff67cc57c3995ec3cf46d696e41f0bba17da0518d94acd4aac", [:mix], [], "hexpm", "2f09b4c1074e0abd846747329eaa26d535be0eb3d189fa69d812bfb8bfefd32f"},
@@ -42,5 +41,5 @@
4241
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
4342
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
4443
"websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"},
45-
"x509": {:hex, :x509, "0.9.1", "c92026a17b7d93f19029842ca218f82ec1f1e7cc9d4aa0c48327ee778f7f482e", [:mix], [], "hexpm", "99328951a1480cfd7b1b8aa688f857f7f5bbea03077b78cad211fb3b30c2f4a8"},
44+
"x509": {:hex, :x509, "0.9.2", "a75aa605348abd905990f3d2dc1b155fcde4e030fa2f90c4a91534405dce0f6e", [:mix], [], "hexpm", "4c5ede75697e565d4b0f5be04c3b71bb1fd3a090ea243af4bd7dae144e48cfc7"},
4645
}

test/honeybadger/events_sampler_test.exs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ defmodule Honeybadger.EventsSamplerTest do
3131
capture_log(fn ->
3232
EventsSampler.sample?(hash_value: "trace-1", server: sampler)
3333
EventsSampler.sample?(hash_value: "trace-2", server: sampler)
34-
Process.sleep(1000)
34+
# Wait for the report timer and ensure message is processed
35+
Process.sleep(110)
36+
# Make a synchronous call to ensure all prior messages are processed
37+
EventsSampler.sample?(hash_value: "sync", server: sampler)
3538
end)
3639

3740
assert log =~ ~r/\[Honeybadger\] Sampled \d events \(of 2 total events\)/
@@ -47,7 +50,10 @@ defmodule Honeybadger.EventsSamplerTest do
4750
EventsSampler.sample?(server: sampler)
4851
EventsSampler.sample?(server: sampler)
4952
EventsSampler.sample?(server: sampler)
50-
Process.sleep(1000)
53+
# Wait for the report timer and ensure message is processed
54+
Process.sleep(110)
55+
# Make a synchronous call to ensure all prior messages are processed
56+
EventsSampler.sample?(server: sampler)
5157
end)
5258

5359
assert log =~ ~r/\[Honeybadger\] Sampled \d events \(of 3 total events\)/

0 commit comments

Comments
 (0)