Skip to content

Commit

Permalink
Add GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
0xPxt committed Jan 20, 2025
1 parent f01a74a commit ce0809e
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Main"
on:
- push

jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
datetime: ${{ steps.get-datetime.outputs.datetime }}
steps:
- id: get-user
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
- id: get-datetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT

build:
needs: [configure]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install node
uses: actions/setup-node@v4
- name: Install dependencies
run: yarn install
- name: Run linter
run: yarn lint
- name: Run formatter
run: yarn format
- name: Build
run: yarn build
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Publish packages"

on:
release:
types:
- published
- edited
tags:
- "v[0-9]+(\\.[0-9]+)*"

jobs:
configure:
runs-on: ubuntu-latest
outputs:
datetime: ${{ steps.get-datetime.outputs.datetime }}
steps:
- id: get-datetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT

publish_npm_package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
scope: "@zondax"
- run: mv README-npm.md README.md
- name: Install yarn
run: npm install -g yarn
- run: yarn install
- run: yarn build
- name: Get latest release version number
id: get_version
uses: battila7/get-version-action@v2
- name: Update tag
run: |
echo Publishing as ${{ steps.get_version.outputs.version }}
npm --allow-same-version --no-git-tag-version version ${{ steps.get_version.outputs.version }}
- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH_AUTO }}
run: |
npm publish
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"Javascript",
"Mina"
],
"homepage": "https://github.com/zondax/ledger-mina-js-priv",
"homepage": "https://github.com/zondax/ledger-mina-js",
"bugs": {
"url": "https://github.com/zondax/ledger-mina-js-priv/issues"
"url": "https://github.com/zondax/ledger-mina-js/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/zondax/ledger-mina-js-priv.git"
"url": "git+https://github.com/zondax/ledger-mina-js.git"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down

0 comments on commit ce0809e

Please sign in to comment.