Skip to content

Commit e1b9fca

Browse files
authored
chore(build): Automate Releases (#216)
* chore(ci): automate releases * CI workflow cleanup * Update elixir and absinthe versions * add cache to other jobs and cleanup yaml * fix caching * add mix_audit * Add PR title validation Release-As: 1.6.0 * add publish workflow * Update absinthe dependency, only versions below 1.7.10 are broken
1 parent 0bdad97 commit e1b9fca

File tree

7 files changed

+186
-70
lines changed

7 files changed

+186
-70
lines changed

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
setup:
10+
name: Setup for Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
11+
runs-on: ubuntu-latest
12+
strategy: &strategy
13+
matrix:
14+
elixir: ["1.15", "1.16", "1.17", "1.18", "1.19"]
15+
otp: ["25", "26", "27", "28"]
16+
# see https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
17+
exclude:
18+
[
19+
{ elixir: 1.15, otp: 27 },
20+
{ elixir: 1.15, otp: 28 },
21+
{ elixir: 1.16, otp: 27 },
22+
{ elixir: 1.16, otp: 28 },
23+
{ elixir: 1.17, otp: 28 },
24+
{ elixir: 1.19, otp: 25 },
25+
]
26+
steps:
27+
- &checkout
28+
name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- &setup
32+
name: Set up Elixir
33+
uses: erlef/setup-beam@v1
34+
with:
35+
otp-version: ${{ matrix.otp }}
36+
elixir-version: ${{ matrix.elixir }}
37+
38+
- &cache
39+
name: Restore deps cache
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
deps
44+
_build
45+
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
46+
restore-keys: |
47+
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
48+
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
49+
50+
- name: Install package dependencies
51+
run: mix deps.get
52+
53+
- name: Compile dependencies
54+
run: mix compile
55+
env:
56+
MIX_ENV: ${{ inputs.mix_env }}
57+
58+
test:
59+
name: Test on Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
60+
runs-on: ubuntu-latest
61+
needs: [setup]
62+
strategy: *strategy
63+
steps:
64+
- *checkout
65+
- *setup
66+
- *cache
67+
- name: Run unit tests
68+
run: mix test
69+
70+
dependencies:
71+
name: Check dependencies
72+
runs-on: ubuntu-latest
73+
needs: [setup]
74+
strategy:
75+
matrix: { elixir: ["1.19"], otp: ["28"] }
76+
steps:
77+
- *checkout
78+
- name: Set up Elixir
79+
uses: erlef/setup-beam@v1
80+
with: { elixir-version: 1.19, otp-version: 28 }
81+
- *cache
82+
- name: Check for unused dependencies
83+
run: mix deps.unlock --check-unused
84+
- name: Check for retired dependencies
85+
run: mix hex.audit
86+
- name: Check for dependencies for known vulnerabilities
87+
run: mix hex.audit
88+
89+
format:
90+
name: Check formatting
91+
runs-on: ubuntu-latest
92+
needs: [setup]
93+
strategy:
94+
matrix: { elixir: ["1.19"], otp: ["28"] }
95+
steps:
96+
- *checkout
97+
- name: Set up Elixir
98+
uses: erlef/setup-beam@v1
99+
with: { elixir-version: 1.19, otp-version: 28 }
100+
- *cache
101+
- name: Check code format
102+
run: mix format --check-formatted
103+
104+
release:
105+
name: Create or Update Release PR
106+
runs-on: ubuntu-latest
107+
needs: [test, dependencies, format]
108+
if: github.ref == 'refs/heads/main'
109+
permissions:
110+
contents: write
111+
pull-requests: write
112+
steps:
113+
- uses: googleapis/release-please-action@v4
114+
with:
115+
token: ${{ secrets.REPO_GITHUB_TOKEN }}
116+
release-type: elixir

.github/workflows/pr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Validate PR Title
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited, reopened]
6+
7+
jobs:
8+
main:
9+
name: Validate PR title
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pull-requests: read
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Hex Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "The git tag for the release to publish"
10+
type: string
11+
required: true
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v3
19+
with:
20+
ref: ${{ inputs.tag || github.ref }}
21+
22+
- name: Set up Elixir
23+
uses: erlef/setup-beam@v1
24+
with:
25+
otp-version: 28
26+
elixir-version: 1.19
27+
28+
- name: Restore deps cache
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
deps
33+
_build
34+
key: deps-${{ runner.os }}-28-1.19-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
35+
restore-keys: |
36+
deps-${{ runner.os }}-28.1.19-${{ hashFiles('**/mix.lock') }}
37+
deps-${{ runner.os }}-28-1.19-${{ matrix.otp }}-${{ matrix.elixir }}
38+
39+
- name: Publish to hex.pm
40+
env:
41+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
42+
run: mix hex.publish --yes

.github/workflows/test.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Make your change. Add tests for your change. Make the tests pass:
2424
Push to your fork (preferably to a non-`master` branch) and
2525
[submit a pull request][pr].
2626

27-
[pr]: https://github.com/absinthe-graphql/absinthe_relay/compare/
27+
Ensure your pull request title follows [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) specification.
2828

2929
We'll review and answer your pull request as soon as possible. We may suggest
3030
some changes, improvements, or alternatives. Let's work through it together.

mix.exs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule AbsintheRelay.Mixfile do
88
[
99
app: :absinthe_relay,
1010
version: @version,
11-
elixir: "~> 1.12",
11+
elixir: "~> 1.15",
1212
elixirc_paths: elixirc_paths(Mix.env()),
1313
build_embedded: Mix.env() == :prod,
1414
start_permanent: Mix.env() == :prod,
@@ -54,9 +54,10 @@ defmodule AbsintheRelay.Mixfile do
5454

5555
defp deps do
5656
[
57-
{:absinthe, "~> 1.5.0 or ~> 1.6.0 or ~> 1.7.0"},
57+
{:absinthe, ">= 1.7.10"},
5858
{:ecto, "~> 2.0 or ~> 3.0", optional: true},
59-
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
59+
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
60+
{:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false}
6061
]
6162
end
6263
end

mix.lock

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
%{
2-
"absinthe": {:hex, :absinthe, "1.7.8", "43443d12ad2b4fcce60e257ac71caf3081f3d5c4ddd5eac63a02628bcaf5b556", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c4085df201892a498384f997649aedb37a4ce8a726c170d5b5617ed3bf45d40b"},
3-
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
2+
"absinthe": {:hex, :absinthe, "1.7.10", "b33471b593260f148d05e4d771d1857e07b70a680f89cfa75184098bef4ec893", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1 or ~> 0.3", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ffda95735364c041a65a4b0e02ffb04eabb1e52ab664fa7eeecefb341449e8c2"},
3+
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
44
"earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"},
55
"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"},
66
"ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [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", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"},
7+
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
78
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
89
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
910
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
10-
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
11+
"mix_audit": {:hex, :mix_audit, "2.1.5", "c0f77cee6b4ef9d97e37772359a187a166c7a1e0e08b50edf5bf6959dfe5a016", [:make, :mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.11", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "87f9298e21da32f697af535475860dc1d3617a010e0b418d2ec6142bc8b42d69"},
12+
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
1113
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
14+
"yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"},
15+
"yaml_elixir": {:hex, :yaml_elixir, "2.12.0", "30343ff5018637a64b1b7de1ed2a3ca03bc641410c1f311a4dbdc1ffbbf449c7", [:mix], [{:yamerl, "~> 0.10", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "ca6bacae7bac917a7155dca0ab6149088aa7bc800c94d0fe18c5238f53b313c6"},
1216
}

0 commit comments

Comments
 (0)