Skip to content

Commit bca1669

Browse files
committed
🔧 chore: Add release workflow
1 parent 45ad973 commit bca1669

File tree

13 files changed

+15649
-5969
lines changed

13 files changed

+15649
-5969
lines changed

.czrc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"path": "./node_modules/cz-emoji",
3+
"config": {
4+
"cz-emoji": {
5+
"symbol": true,
6+
"conventional": true,
7+
"format": "{emoji} {type}{scope}: {subject}",
8+
"skipQuestions": [
9+
"issues"
10+
],
11+
"types": [
12+
{
13+
"emoji": "✨",
14+
"code": ":sparkles:",
15+
"description": "A new feature.",
16+
"name": "feature"
17+
},
18+
{
19+
"emoji": "🐛",
20+
"code": ":bug:",
21+
"description": "A bug fix.",
22+
"name": "fix"
23+
},
24+
{
25+
"emoji": "📝",
26+
"code": ":pencil:",
27+
"description": "Documentation changes.",
28+
"name": "docs"
29+
},
30+
{
31+
"emoji": "💄",
32+
"code": ":lipstick:",
33+
"description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc).",
34+
"name": "style"
35+
},
36+
{
37+
"emoji": "♻️",
38+
"code": ":recycle:",
39+
"description": "A code change that neither fixes a bug nor adds a feature.",
40+
"name": "refactor"
41+
},
42+
{
43+
"emoji": "⚡️",
44+
"code": ":zap:",
45+
"description": "A code change that improves performance.",
46+
"name": "perf"
47+
},
48+
{
49+
"emoji": "🧪",
50+
"code": ":test_tube:",
51+
"description": "Adding tests or fixing existing tests.",
52+
"name": "test"
53+
},
54+
{
55+
"emoji": "🔧",
56+
"code": ":wrench:",
57+
"description": "Other changes that don't modify src or test files.",
58+
"name": "chore"
59+
}
60+
]
61+
}
62+
}
63+
}

.favolosoEmojirc.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"emojis": {
3+
"feature": {
4+
"type": "feat",
5+
"emoji": "",
6+
"heading": "✨ Features",
7+
"bump": "minor",
8+
"inChangelog": true,
9+
"index": 20
10+
},
11+
"fix": {
12+
"type": "fix",
13+
"emoji": "🐛",
14+
"heading": "🐛 Fixes",
15+
"bump": "patch",
16+
"inChangelog": true,
17+
"index": 21
18+
},
19+
"docs": {
20+
"type": "docs",
21+
"emoji": "📝",
22+
"heading": "📝 Documentation",
23+
"bump": "patch",
24+
"inChangelog": true,
25+
"index": 22
26+
},
27+
"style": {
28+
"type": "style",
29+
"emoji": "💄",
30+
"heading": "🧰 Other Commits",
31+
"bump": "patch",
32+
"inChangelog": true,
33+
"index": 40
34+
},
35+
"refactor": {
36+
"type": "refactor",
37+
"emoji": "",
38+
"heading": "🧰 Other Commits",
39+
"bump": "patch",
40+
"inChangelog": true,
41+
"index": 41
42+
},
43+
"perf": {
44+
"type": "perf",
45+
"emoji": "",
46+
"heading": "🧰 Other Commits",
47+
"bump": "patch",
48+
"inChangelog": true,
49+
"index": 42
50+
},
51+
"test": {
52+
"type": "test",
53+
"emoji": "🧪",
54+
"heading": "🧰 Other Commits",
55+
"bump": "patch",
56+
"inChangelog": true,
57+
"index": 43
58+
},
59+
"chore": {
60+
"type": "chore",
61+
"emoji": "🔧",
62+
"heading": "🧰 Other Commits",
63+
"bump": "patch",
64+
"inChangelog": true,
65+
"index": 44
66+
},
67+
"release": {
68+
"type": "release",
69+
"emoji": "🚀",
70+
"bump": "patch",
71+
"inChangelog": false,
72+
"index": 90
73+
}
74+
}
75+
}

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
name: release
11+
12+
env:
13+
IS_MERGED_RELEASE_PR: ${{ startsWith(github.event.head_commit.message, '🚀 release:') }}
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup GIT
25+
uses: fregante/setup-git-user@v2
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 16
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: Install dependencies
34+
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
35+
run: npm ci --ignore-scripts
36+
37+
- name: Install dependencies and build package
38+
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
39+
run: npm ci
40+
41+
# release-it configuration reference
42+
# https://github.com/release-it/release-it/blob/fdcf005ced6967a86305a3e10fd1d61a3149407b/docs/configuration.md#configuration
43+
# https://github.com/release-it/release-it/blob/HEAD/config/release-it.json
44+
45+
- name: Bump version and update changelog
46+
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
47+
run: npx release-it --no-npm.publish --no-git --no-github.release --ci
48+
49+
- name: Preview changelog
50+
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
51+
id: preview-changelog
52+
run: |
53+
{
54+
echo 'changelog<<EOF'
55+
npx conventional-changelog -p @favoloso/emoji -u
56+
echo EOF
57+
} > "$GITHUB_OUTPUT"
58+
59+
- name: Read package.json version
60+
id: package-version
61+
uses: martinbeentjes/npm-get-version-action@v1.3.1
62+
63+
- name: Create release PR
64+
if: ${{ env.IS_MERGED_RELEASE_PR == 'false' }}
65+
uses: peter-evans/create-pull-request@v5
66+
with:
67+
branch: "release"
68+
commit-message: "🚀 release: ${{ steps.package-version.outputs.current-version }}"
69+
delete-branch: true
70+
labels: release-preview
71+
title: ${{ steps.package-version.outputs.current-version }}
72+
body: ${{ steps.preview-changelog.outputs.changelog }}
73+
74+
- name: Read changelog
75+
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
76+
id: read-changelog
77+
run: |
78+
{
79+
echo 'changelog<<EOF'
80+
npx conventional-changelog -p @favoloso/emoji -r 1
81+
echo EOF
82+
} > "$GITHUB_OUTPUT"
83+
84+
- name: Git tag, GitHub release
85+
if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
86+
uses: avakar/tag-and-release@v1
87+
with:
88+
tag_name: ${{ steps.package-version.outputs.current-version }}
89+
release_name: ${{ steps.package-version.outputs.current-version }}
90+
body: ${{ steps.read-changelog.outputs.changelog }}
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
94+
# - name: Publish NPM package
95+
# if: ${{ env.IS_MERGED_RELEASE_PR == 'true' }}
96+
# run: npm publish
97+
# env:
98+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.release-it.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"git": {
3+
"push": false,
4+
"tagName": "${version}",
5+
"commitMessage": "🚀 release: ${version}"
6+
},
7+
"github": {
8+
"releaseName": "${version}"
9+
},
10+
"plugins": {
11+
"@release-it/conventional-changelog": {
12+
"preset": "@favoloso/emoji",
13+
"infile": "CHANGELOG.md"
14+
}
15+
}
16+
}

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Changelog
1+
# 2.0.0 (2023-10-13)
22

3-
All notable changes to this project will be documented in this file.
4-
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
53

6-
## [1.1.0](https://github.com/localazy/ts-api/compare/v1.0.14...v1.1.0) (2023-07-27)
4+
### ✨ Features
75

8-
### [1.0.14](https://github.com/localazy/ts-api/compare/v1.0.13...v1.0.14) (2023-07-27)
6+
* feature: Api client v2 ([df4bcee](https://github.com/localazy/api-client/commit/df4bcee))
7+
8+
9+
### 🧰 Other Commits
10+
11+
* chore: Add release workflow ([803d60e](https://github.com/localazy/api-client/commit/803d60e))
912

10-
# Changelog
1113

12-
All notable changes to this project will be documented in this file.
13-
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
<p align="center">
1212
<a href="https://github.com/localazy/api-client"><img src="https://img.shields.io/badge/@localazy-ts--api-066fef?style=for-the-badge" height="22" alt="@localazy/api-client"></a>
1313
<a href="https://npmjs.com/package/@localazy/api-client"><img src="https://img.shields.io/github/package-json/v/localazy/ts-api/main?style=for-the-badge&label=version&color=066fef" height="22" alt="npm"></a>
14-
<a href="#"><img src="https://img.shields.io/badge/schema-OpenAPI-066fef?style=for-the-badge&color=066fef" height="22" alt="schema"></a>
1514
<a href="https://github.com/localazy/api-client/blob/main/LICENSE"><img src="https://img.shields.io/github/license/localazy/ts-api?style=for-the-badge&color=066fef" height="22" alt="license"></a>
16-
<br>
17-
<a href="#"><img src="https://img.shields.io/badge/build-passing-success?style=for-the-badge" height="22" alt="build"></a>
18-
<a href="#"><img src="https://img.shields.io/badge/coverage-100%25-success?style=for-the-badge" height="22" alt="coverage"></a>
15+
16+
[//]: # (<a href="#"><img src="https://img.shields.io/badge/schema-OpenAPI-066fef?style=for-the-badge&color=066fef" height="22" alt="schema"></a>)
17+
18+
[//]: # ( <br>)
19+
20+
[//]: # ( <a href="#"><img src="https://img.shields.io/badge/build-passing-success?style=for-the-badge" height="22" alt="build"></a>)
21+
22+
[//]: # ( <a href="#"><img src="https://img.shields.io/badge/coverage-100%25-success?style=for-the-badge" height="22" alt="coverage"></a>)
1923
</p>
2024

2125
# 📦 Localazy API Client
@@ -91,7 +95,7 @@ Check out other npm packages from Localazy:
9195
| | NPM package | Description |
9296
|:---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|----------------------------------------------|
9397
| <img src="https://localazy.com/directus9/assets/3f76ff7b-0e74-4046-bb03-4ca99c3b66d5" width="50" height="50" alt="cli"> | [@localazy/cli](https://www.npmjs.com/package/@localazy/cli) | Localazy CLI tool. |
94-
| <img src="https://localazy.com/directus9/assets/20866781-e69b-4e01-9456-05437487b75c" width="50" height="50" alt="localazy-api"> | [@localazy/ts-api](https://www.npmjs.com/package/@localazy/api-client) | Localazy API client. |
98+
| <img src="https://localazy.com/directus9/assets/20866781-e69b-4e01-9456-05437487b75c" width="50" height="50" alt="localazy-api"> | [@localazy/api-client](https://www.npmjs.com/package/@localazy/api-client) | Localazy API client. |
9599
| <img src="https://localazy.com/directus9/assets/c9e70e4f-8136-432a-8d82-53c3501a9eb4" width="50" height="50" alt="languages"> | [@localazy/languages](https://www.npmjs.com/package/@localazy/languages) | List of all languages supported by Localazy. |
96100
| <img src="https://localazy.com/directus9/assets/1dd05c76-e517-4aea-a3d8-49cfddb40056" width="50" height="50" alt="strapi"> | [@localazy/strapi-plugin](https://www.npmjs.com/package/@localazy/strapi-plugin) | The official Localazy Strapi plugin. |
97101

jest.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const config: Config = {
1111
],
1212
moduleNameMapper: {
1313
'^~/(.*)$': '<rootDir>/src/$1',
14+
'lodash-es': 'lodash',
1415
},
1516
moduleFileExtensions: [
1617
'ts',
@@ -20,6 +21,9 @@ const config: Config = {
2021
'^.+\\.ts$': 'ts-jest',
2122
'^.+\\.js$': 'babel-jest',
2223
},
24+
// transformIgnorePatterns: [
25+
// '<rootDir>/node_modules/(?!lodash-es)',
26+
// ],
2327
collectCoverage: true,
2428
collectCoverageFrom: [
2529
'<rootDir>/src/**/*.ts',

0 commit comments

Comments
 (0)