Skip to content

Commit

Permalink
chore: adopt semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-viney committed Nov 13, 2024
1 parent 418a6f5 commit 9c08867
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 11 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
branches: main

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-24.04
environment: release
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup BEAM
uses: erlef/setup-beam@v1
with:
otp-version: "27.1.0"
gleam-version: "1.5.0"
rebar3-version: "3"

- name: Wait for tests to complete
uses: lewagon/[email protected]
with:
ref: ${{ github.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
check-regexp: Test

- name: Semantic release
id: semantic-release
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Hex package manager
if: steps.semantic-release.outputs.new_release_published == 'true'
env:
HEXPM_API_KEY: ${{ secrets.HEXPM_API_KEY }}
run: |
echo 'version = "${{ steps.semantic-release.outputs.new_release_version }}"' | cat - gleam.toml > gleam.toml.new
mv gleam.toml.new gleam.toml
gleam publish --yes
22 changes: 17 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
test:
name: Test
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
Expand All @@ -25,14 +26,25 @@ jobs:
with:
node-version: 22

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.0

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1

- name: Install dependencies
run: gleam deps download

- name: Run tests on Erlang target
run: gleam test

- name: Run tests on JavaScript target
run: gleam test --target javascript
- name: Run tests
run: |
gleam test --target erlang
gleam test --target javascript --runtime node
gleam test --target javascript --runtime deno
gleam test --target javascript --runtime bun
- name: Check code formatting
run: gleam format --check src test
6 changes: 6 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
preset: conventionalcommits

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/github"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This Gleam library provides an `IEEEFloat` type that is compliant with the IEEE
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/ieee_float/)
![Erlang Compatible](https://img.shields.io/badge/target-erlang-a90432)
![JavaScript Compatible](https://img.shields.io/badge/target-javascript-f3e155)
[![Semantic Release](https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)

## Background

Expand Down
8 changes: 5 additions & 3 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name = "ieee_float"
version = "1.0.3"
description = "Gleam library that provides an IEEE 754 compliant float type."
licences = ["MIT"]
repository = { type = "github", user = "richard-viney", repo = "ieee_float" }
Expand All @@ -8,8 +7,11 @@ links = [
]

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_erlang = ">= 0.25.0 and < 1.0.0"
gleam_stdlib = ">= 0.41.0 and < 2.0.0"
gleam_erlang = ">= 0.28.0 and < 1.0.0"

[dev-dependencies]
gleeunit = ">= 1.2.0 and < 2.0.0"

[javascript]
deno = { allow_read = true }
6 changes: 3 additions & 3 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_erlang", version = "0.28.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "BE551521F708DCE5CB954AFBBDF08519C1C44986521FD40753608825F48FFA9E" },
{ name = "gleam_erlang", version = "0.30.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "760618870AE4A497B10C73548E6E44F43B76292A54F0207B3771CBB599C675B4" },
{ name = "gleam_stdlib", version = "0.41.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1B2F80CB1B66B027E3198A2FF71EF3F2F31DF89ED97AD606F25FD387A4C3C1EF" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
]

[requirements]
gleam_erlang = { version = ">= 0.25.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_erlang = { version = ">= 0.28.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.41.0 and < 2.0.0" }
gleeunit = { version = ">= 1.2.0 and < 2.0.0" }

0 comments on commit 9c08867

Please sign in to comment.