Skip to content

Commit

Permalink
Merge pull request #5 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Release 1.0
  • Loading branch information
TheLastCicada authored Sep 22, 2023
2 parents 00d24b0 + 0ca45e2 commit 3d11660
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 7 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Compares the version in package.json to tags on the repo. If the tag doesn't exist, a new tag is created, which
# then triggers the normal "on tag" release automation in the build job
name: Auto Tag

on:
push:
branches:
- main

concurrency:
group: main-release-check

jobs:
check-version:
name: Tag and Release
runs-on: ubuntu-latest
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
fetch-depth: 0

- name: Configure commit signing for ChiaAutomation
uses: Chia-Network/actions/commit-sign/gpg@main
with:
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }}
passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}

- name: Check for current version tag. Create if it doesn't exist
run: |
version=$(cat $GITHUB_WORKSPACE/package.json | jq -r '.version')
echo "Version is: $version"
if [ $(git tag -l "$version") ]; then
echo "Tag exists, nothing to do"
else
echo "Tag does not exist. Creating and pushing tag"
rm -f CHANGELOG.md
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0
changes=$(npx conventional-changelog-cli -r 1 | tail -n +2)
git add CHANGELOG.md
git commit -m "chore: Updating changelog for $version"
git tag $version -m "Release $version \n$changes"
git push origin $version
git push origin main
fi
42 changes: 42 additions & 0 deletions .github/workflows/ensure-version-increment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow runs on any PRs that are targeting main, and ensures that the version in package.json is incremented
name: Check Version Increment

on:
pull_request:
branches:
- 'main'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true

jobs:
check-version:
name: Check version increment
runs-on: ubuntu-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main

- name: Checkout current branch
uses: actions/checkout@v3
with:
path: branch-repo

- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
path: main-repo

- name: Check Versions
run: |
main_version=$(cat $GITHUB_WORKSPACE/main-repo/package.json | jq -r '.version')
branch_version=$(cat $GITHUB_WORKSPACE/branch-repo/package.json | jq -r '.version')
echo "Main version: $main_version"
echo "Branch version: $branch_version"
if [[ "$branch_version" == "$main_version" ]]; then
echo "Version in package.json on this branch is not changing. Version must incremenet for a merge to main"
exit 1
fi
31 changes: 31 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish to NPM

on:
release:
types: [published]

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 18.x
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Publish to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish --access public
- name: Cleanup
if: always()
run: rm .npmrc || true
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# node-template
Template repo for NodeJS-based projects
# Core Registry Logger

example usage

Expand All @@ -10,4 +9,4 @@ const logger = new Logger({
logLevel: 'info',
packageVersion: '1.0.0'
});
```
```
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{
"name": "core-registry-logger",
"name": "@chia-carbon/core-registry-logger",
"version": "1.0.0",
"description": "Custom logger for core registry projects",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Michael Taylor",
"license": "ISC",
"author": "Chia Network",
"email": "[email protected]",
"url": "https://www.chia.net/",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Chia-Network/core-registry-logger.git"
},
"bugs":{
"url": "https://github.com/Chia-Network/core-registry-logger/issues"
},
"dependencies": {
"chia-root-resolver": "^1.0.0",
"winston": "^3.10.0",
"winston-daily-rotate-file": "^4.7.1"
}
},
"contributors": [
"Michael.Taylor <[email protected]>",
"Chris Marslender <[email protected]>",
"Zach Brown <[email protected]>"
]
}

0 comments on commit 3d11660

Please sign in to comment.