Skip to content

Commit

Permalink
Merge pull request #6 from HyperPlay-Gaming/sync/testing
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
BrettCleary authored Mar 25, 2024
2 parents f7033f6 + 7f3e754 commit c203242
Show file tree
Hide file tree
Showing 5 changed files with 5,370 additions and 377 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release to npm

on:
push:
paths:
- 'package.json'
branches:
- main

jobs:
release:
uses: HyperPlay-Gaming/workflows/.github/workflows/npm_publish.yml@main
with:
node_version: '18'
pkg_manager: 'yarn'
install: 'yarn'
build: 'yarn buildDist'
publish: 'yarn publish'
pkg_manager_add_dev_dep: 'yarn add -D'
secrets:
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'b
21 changes: 21 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Chain Sync

# run on the 1st and 15th of the month at midnight or on dispatch
on:
schedule:
- cron: '0 * 1,15 * *'
workflow_dispatch:

jobs:
sync:
uses: HyperPlay-Gaming/workflows/.github/workflows/nodejs_commands.yml@main
with:
node_version: '16'
pkg_manager: 'yarn'
install: 'yarn install --immutable --frozen-lockfile'
name: 'sync'
command_one: 'yarn sync'
command_one_name: 'Sync chains and submit PR'
checkout_recursive: false
secrets:
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
22 changes: 22 additions & 0 deletions cd/bumpPkgVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import fs from 'fs'

async function main(){
const packageJsonBuffer = fs.readFileSync('./package.json')
const packageJson = JSON.parse(packageJsonBuffer.toString())
packageJson.version = packageJson.version.split('.').map((element: any, index: number)=>{
element = Number.parseInt(element)
let newElement = element
if (index === 1){
return newElement = element + 1
}
return newElement.toString()
}).reduce((accumulator: any, currentValue: any)=>{
if (accumulator === ''){
return currentValue
}
return accumulator + '.' + currentValue
}, '')
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2))
}

main()
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperplay/chains",
"version": "0.1.4",
"version": "0.2.4",
"description": "A package to get chain metadata",
"main": "src/index.js",
"author": "Brett Cleary",
Expand All @@ -16,7 +16,10 @@
"scripts": {
"generateChainMap": "ts-node ./src/generateChainMap.ts",
"buildDist": "vite build",
"test": "vitest"
"test": "vitest",
"bumpPkgVersion": "ts-node ./cd/bumpPkgVersion.ts",
"syncNewChains": "yarn bumpPkgVersion && git checkout -b sync/testing && yarn generateChainMap && git add * && git commit -m 'update' && git push --set-upstream origin sync/testing && yarn submitPR",
"submitPR": "gh pr create --title Sync --body body"
},
"dependencies": {
"axios": "^1.4.0"
Expand Down
Loading

0 comments on commit c203242

Please sign in to comment.