Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BENS types package #914

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/bens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
Expand All @@ -161,3 +162,11 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-cache
cache-to: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}/{1}:build-cache,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }}

- name: Publish types package
uses: './.github/workflows/npm-publisher.yml'
if: steps.regex.outputs.group2 != ''
continue-on-error: true
with:
version: ${{ steps.regex.outputs.group2 }}
project_name: blockscout-ens
59 changes: 59 additions & 0 deletions .github/workflows/npm-publisher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish types package to NPM

on:
workflow_dispatch:
inputs:
version:
description: Package version
type: string
required: true
project_name:
description: Project name
type: choice
options:
- blockscout-ens
required: true
workflow_call:
inputs:
version:
description: Package version
type: string
required: true
project_name:
description: Project name
type: string
required: true

jobs:
publish:
runs-on: ubuntu-latest
name: Publish package to NPM registry

steps:
- name: Checkout repo
uses: actions/checkout@v4

# Also it will setup .npmrc file to publish to npm
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Update package version
run: |
cd ./${{ inputs.project_name }}/types
npm version ${{ inputs.version }}

- name: Build the package
run: |
cd ./${{ inputs.project_name }}/types
npm install
npm run build

- name: Publish to NPM registry
run: |
cd ./${{ inputs.project_name }}/types
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions blockscout-ens/types/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node-modules
/dist
1 change: 1 addition & 0 deletions blockscout-ens/types/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
172 changes: 172 additions & 0 deletions blockscout-ens/types/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions blockscout-ens/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@blockscout/bens-types",
"version": "0.0.1",
"description": "TypeScript definitions for BENS microservice",
"main": "./dist/bens-proto/proto/bens.ts",
"scripts": {
"build": "mkdir -p ./dist && protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=onlyTypes=true --ts_proto_opt=emitImportedFiles=false --proto_path=../ --proto_path=../../proto/ --ts_proto_out=./dist ../bens-proto/proto/bens.proto"
},
"repository": {
"type": "git",
"url": "https://github.com/blockscout/blockscout-rs.git",
"directory": "blockscout-ens/types"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/blockscout/blockscout-rs/issues"
},
"homepage": "https://github.com/blockscout/blockscout-rs#readme",
"devDependencies": {
"ts-proto": "1.176.2"
}
}
Loading