Skip to content

Commit

Permalink
feat: add release automation (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
igas authored Jan 31, 2025
1 parent 59951ec commit 0d08ed2
Show file tree
Hide file tree
Showing 10 changed files with 7,023 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: ci

on:
push:
pull_request:

jobs:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
branches:
- master
- dev

permissions:
contents: read

jobs:
test:
uses: ./.github/workflows/ci.yml
permissions:
contents: read

release:
needs: test

runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/[email protected]
with:
persist-credentials: false

- name: Set up Elixir
id: setup-beam
uses: erlef/[email protected]
with:
version-type: strict
version-file: .tool-versions

- name: Restore dependencies cache
uses: actions/[email protected]
env:
cache-key: deps
with:
key: ${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
restore-keys: |
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}
path: |
deps
_build
- name: Install dependencies
run: |
mix local.hex --force
mix do deps.get, deps.compile
- name: Use Node.js LTS
uses: actions/[email protected]
with:
node-version-file: ".tool-versions"

- name: Install packages
run: npm ci

- name: Audit npm signatures
run: npm audit signatures

- name: Run Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
*.ez
*.iml
*.swp
.DS_Store
.envrc
/.elixir_ls
/.idea
/.vscode
/_build
/deps
/.idea
/doc
/.elixir_ls
/.vscode
/node_modules
erl_crash.dump
*.ez
*.swp
*.iml
.DS_Store
.tool-versions
90 changes: 90 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"branches": [
"master",
{
"name": "dev",
"prerelease": "alpha",
"channel": "alpha"
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"]
}
}
],
[
"semantic-release-replace-plugin",
{
"replacements": [
{
"files": ["mix.exs"],
"from": "@version \".*\"",
"to": "@version \"${nextRelease.version}\"",
"results": [
{
"file": "mix.exs",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
},
{
"files": ["README.md"],
"from": "\"~> .*\"",
"to": "\"~> ${nextRelease.version}\"",
"results": [
{
"file": "README.md",
"hasChanged": true,
"numMatches": 2,
"numReplacements": 2
}
],
"countMatches": true
}
]
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/git",
{
"assets": ["mix.exs", "README.md", "CHANGELOG.md"],
"message": "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github",
[
"@semantic-release/exec",
{
"publishCmd": "mix hex.publish --yes"
}
]
]
}
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
erlang 27.2
elixir 1.18.1
nodejs 22.13.0
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Change Log
# Changelog

All notable changes to this project will be documented in this file.

Expand Down Expand Up @@ -66,13 +66,15 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.
### Deprecated

### Removed

- Travis CI for CI workflow [[@anthonator](https://github.com/anthonator)]

### Fixed

- `Faker.Team` `creature/0` and `name/0` documentation examples fixed [[@yuriploc](https://github.com/yuriploc)]
- Fix bidirectional formatting [[@MichalDolata](https://github.com/MichalDolata)]
- Extra split for Virgin Islands in the country sampler [[intercaetera](https://github.com/intercaetera)]

### Security

## 0.16.0
Expand Down Expand Up @@ -147,6 +149,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.
- `Faker.Phone.PtBr`[[@netond](https://github.com/netond)]

### Changed

- Fix `Faker.Code.Iban.iban` and `Faker.Gov.It.fiscal_id` doctests [[@vbrazo](https://github.com/vbrazo)]
- `Faker.Address.Es` [[@emig](https://github.com/emig)]
- Set minimum Elixir version to 1.6
Expand All @@ -165,6 +168,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.
- Elixir 1.4 and 1.5 support

### Fixed

- `Faker.Util.upper_letter/0` documentation examples [[@michaelfich](https://github.com/michaelfich)]

### Security
Expand Down
8 changes: 4 additions & 4 deletions lib/faker/airports.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1029,13 +1029,13 @@ defmodule Faker.Airports do
## Examples
iex> Faker.Airports.iata()
"BFU"
"UBJ"
iex> Faker.Airports.iata()
"FMM"
"CKB"
iex> Faker.Airports.iata()
"YUS"
"JAL"
iex> Faker.Airports.iata()
"YPH"
"PES"
"""
@spec iata() :: String.t()
sampler(:iata, [
Expand Down
6 changes: 4 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ defmodule Faker.Mixfile do
name: "Faker",
deps: deps(),
docs: docs(),
source_url: @source_url,
homepage_url: @source_url,
preferred_cli_env: [
"test.watch": :test
],
Expand Down Expand Up @@ -63,11 +65,11 @@ defmodule Faker.Mixfile do
end

defp package do
%{
[
maintainers: ["Anthony Smith", "Igor Kapkov", "Toby Hinloopen", "Vitor Oliveira"],
files: ["lib", "mix.exs", "mix.lock", "README.md", "LICENSE", "CHANGELOG.md"],
licenses: ["MIT"],
links: %{"GitHub" => @source_url}
}
]
end
end
Loading

0 comments on commit 0d08ed2

Please sign in to comment.