Skip to content

Commit

Permalink
auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
vokenLymanSnow committed Feb 20, 2021
1 parent 8c58dd6 commit e94eced
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 12 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tag, Release, & Publish

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: tag
id: autotagger
uses: butlerlogic/action-autotag@stable
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: release
id: create_release
if: steps.autotagger.outputs.tagcreated == 'yes'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.autotagger.outputs.tagname }}
release_name: ${{ steps.autotagger.outputs.tagname }}

- name: setup node
id: setup_node
if: steps.autotagger.outputs.tagname != ''
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/

- name: publish
id: publish
if: steps.autotagger.outputs.tagname != ''
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voken/avatar",
"version": "1.1.0",
"version": "1.3.1",
"description": "Create a `.svg` avatar from `seed`",
"keywords": [
"avatar",
Expand All @@ -22,7 +22,7 @@
"main": "src/index.js",
"dependencies": {
"@dicebear/avatars": "^4.5.2",
"@dicebear/avatars-gridy-sprites": "^4.5.2"
"@dicebear/avatars-jdenticon-sprites": "^4.5.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
27 changes: 17 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
const crypto = require('crypto')
const Avatars = require('@dicebear/avatars').default
const sprites = require('@dicebear/avatars-gridy-sprites').default
// const sprites = require('@dicebear/avatars-gridy-sprites').default
const sprites = require('@dicebear/avatars-jdenticon-sprites').default

const svgFromSeed = function (seed) {
const options = {
colorful: true,
deterministic: true
}
const avatars = new Avatars(sprites, options)
return avatars.create(seed)
// const options = {
// colorful: true,
// deterministic: true
// }
// const avatars = new Avatars(sprites, options)
const avatars = new Avatars(sprites)
return avatars.create(_sha256(seed))
}

const svgDataUriFromSeed = function (seed) {
const options = {
dataUri: true,
colorful: true,
deterministic: true
// colorful: true,
// deterministic: true
}
const avatars = new Avatars(sprites, options)
return avatars.create(seed)
return avatars.create(_sha256(seed))
}

const _sha256 = function (value) {
return crypto.createHash('sha256').update(value).digest().toString('hex')
}

module.exports = {
Expand Down

0 comments on commit e94eced

Please sign in to comment.