Skip to content

Commit

Permalink
update;
Browse files Browse the repository at this point in the history
  • Loading branch information
iSplasher committed Sep 25, 2023
1 parent ab662d5 commit cf6c6b7
Show file tree
Hide file tree
Showing 45 changed files with 4,871 additions and 366 deletions.
45 changes: 0 additions & 45 deletions .babelrc.js

This file was deleted.

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

on:
push:
branches:
- master

env:
NODE_VERSION: "18.x"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # entire history is needed for the changelog

- name: Read manifest
run: |
echo "PACKAGE_NAME=$(cat package.json | jq -r '.name')" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
echo "TAG_NAME=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"

# check if tag exists and fail if not [force-release] in commit message
- name: Check if tag exists
id: check_tag
if: "!contains(github.event.head_commit.message, '[force-release]')"
run: |
git fetch --tags &> /dev/null
if git rev-parse ${{ env.TAG_NAME }} >/dev/null 2>&1; then
echo "Tag ${{ env.TAG_NAME }} already exists; Use [force-release] to skip check."
exit 1
else
npm run version
git add versions.json manifest.json manifest-beta.json
echo "Will create tag ${{ env.TAG_NAME }} on release."
echo "PUSH_TAG=true" >> $GITHUB_ENV
fi
- name: Force release
if: "contains(github.event.head_commit.message, '[force-release]')"
run: |
echo "Will create tag ${{ env.TAG_NAME }} on release."
echo "PUSH_TAG=true" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{hashFiles('package-lock.json')}}
restore-keys: node_modules- # Take any latest cache if failed to find it for current lock file

- name: Install dependencies
run: yarn install

- name: Build
id: build
run: yarn build

- name: Zip dist
id: zip
run: |
cd dist
zip -r ../isomorphic-logger.zip *
cd ..
- name: Generate changelog
id: changelog
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --verbose --tag ${{ env.TAG_NAME }}
env:
OUTPUT: CHANGELOG.md

- name: Setup git user
run: |
git config --local user.name "Github Actions"
git config --local user.email "[email protected]"
- name: Commit and push changelog
run: |
if ! git diff --quiet CHANGELOG.md; then
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md"
git push
else
echo "No changes to CHANGELOG.md"
fi
- name: Create tag and push
if: env.PUSH_TAG == 'true'
run: |
git commit --allow-empty -m "Release ${{ env.TAG_NAME }}"
git tag ${{ env.TAG_NAME }} || true
git push
git push origin ${{ env.TAG_NAME }}
- name: Generate latest changes
id: changes
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: --verbose --latest --strip header
env:
OUTPUT: "CHANGELOG.md"


- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.TAG_NAME }}
body: ${{ steps.changes.outputs.content }}
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
isomorphic-logger.zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
## Assembly target defined in Webpack config
target

dist/


### JetBrains

Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
79 changes: 79 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
### Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://tera.netlify.app/docs
body = """
{% if version %}\
#### [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
#### [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
##### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
The entire changelog is found at `CHANGELOG.md`.
<!-- generated by git-cliff -->
"""

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features ✨" },
{ message = "^fix", group = "Bug Fixes 🐞" },
{ message = "^doc", group = "Documentation" },
{ message = "^ench", group = "Changes 🛠" },
{ message = "^improv", group = "Changes 🛠" },
{ message = "^perf", group = "Performance ⚡️" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security 🔒" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "[0-9]*"
# regex for skipping tags
skip_tags = "0.0.0"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42
17 changes: 0 additions & 17 deletions deploy.sh

This file was deleted.

28 changes: 9 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@isplasher/isomorphic-logger",
"version": "1.0.0",
"version": "0.1.0",
"author": "iSplasher <[email protected]>",
"description": "Isomorphic logger",
"keywords": [
Expand All @@ -27,11 +27,10 @@
"main": "dist/index.js",
"homepage": "https://github.com/iSplasher/isomorphic-logger",
"scripts": {
"build": "rm -rf target/out && cross-env NODE_ENV=production babel src/main -d target/out",
"test": "NODE_ENV=test jest --colors",
"babel-flow": "rm -rf target/flow; BABEL_ENV=flow babel src -d target/flow",
"flow": "flow",
"flow-watch": "rm -rf target/flow; BABEL_ENV=flow babel src -d target/flow --watch & PID=$!; sleep 5; flow-watch; kill -9 $PID"
"dev": "cross-env NODE_ENV=development tsup --watch",
"types": "tsc",
"build": "cross-env NODE_ENV=production tsup && yarn types",
"test": "jest --colors"
},
"jest": {
"testPathIgnorePatterns": [
Expand All @@ -40,20 +39,11 @@
]
},
"devDependencies": {
"@babel/cli": "^7.17.3",
"@babel/core": "^7.17.4",
"@babel/plugin-transform-regenerator": "7.16.7",
"@babel/plugin-transform-runtime": "7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-flow": "^7.16.7",
"@babel/preset-stage-0": "^7.8.3",
"@babel/runtime": "^7.17.2",
"babel-jest": "^27.5.1",
"@types/jest": "^29.5.5",
"cross-env": "^7.0.3",
"flow-bin": "^0.171.0",
"flow-watch": "^2.0.0",
"jest": "^27.5.1",
"typescript": "^4.5.5"
"jest": "^29.7.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
},
"dependencies": {
"moment": "2.29.1",
Expand Down
Loading

0 comments on commit cf6c6b7

Please sign in to comment.