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

WIP: Feat/versioning #71

Merged
merged 17 commits into from
Feb 21, 2024
Merged
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
172 changes: 172 additions & 0 deletions .github/workflows/build-test-publish-on-push-cached.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: build-test-publish-on-push-cached
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
- 'next'
- 'unstable'
push:
branches:
- 'main'
- 'next'
- 'unstable'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- run: pnpm install
- run: pnpm build
- name: 'Save build output'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}

test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Restore build output'
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: 'Run node'
run: pnpm test
- uses: actions/upload-artifact@v3
with:
name: coverage-artifacts
path: coverage/

report-coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/download-artifact@v3
with:
name: coverage-artifacts
path: coverage
# - name: Merge Code Coverage
# run: npx nyc merge coverage/ coverage/coverage-final.json
# TODO: include once we have codecov token setup
# - uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: false

# lint:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: pnpm/action-setup@v3
# with:
# version: 8
# - run: pnpm add -g pnpm
# - name: 'Restore build output'
# uses: actions/cache/restore@v4
# with:
# path: ${{ github.workspace }}
# key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-build-${{ github.sha }}
# fail-on-cache-miss: true
# - name: 'Setup Node.js with pnpm cache'
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: 'pnpm'
# - name: 'Run lint'
# run: pnpm run lint

# Only run this job when the push is on main, next or unstable
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/unstable')
needs:
- build
- test
# - lint
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
GH_USER: ${{secrets.GH_USER}}
GH_EMAIL: ${{secrets.GH_EMAIL}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{secrets.GH_TOKEN}}
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 'Restore build output'
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true

- name: 'Setup git coordinates'
run: |
git remote set-url origin https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/${{ github.repository }}.git
git config user.name $GH_USER
git config user.email $GH_EMAIL

- name: 'Setup npm registry'
run: |
echo "@veramo:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami

- name: 'Publish @latest when on main'
if: github.ref == 'refs/heads/main'
run: pnpm publish:latest

- name: 'Publish @next when on next'
if: github.ref == 'refs/heads/next'
run: pnpm publish:next

- name: 'Publish @unstable when on unstable branch'
if: github.ref == 'refs/heads/unstable'
run: pnpm publish:unstable
26 changes: 0 additions & 26 deletions .github/workflows/test-pr.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
dist

.vscode
coverage
coverage
.npmrc
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3](https://github.com/openwallet-foundation-labs/sd-jwt-js/compare/v2.0.2...v2.0.3) (2024-02-20)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that this changelog generated automatically, is it right?
It might be needed to fix manually as we discuss in #44. To 0.x

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the generated one from this PR. As mentioned above, I don't know what's the best way to generate the changelog that should be part of the github repo. It should be relatively easy to use the release mechanism of github

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cre8 I think we might need to reset all the tags in this repo when we deploy to @sd-jwt/*

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess release mechanism of github is easiest way :D.



### Bug Fixes

* update versioning ([058a562](https://github.com/openwallet-foundation-labs/sd-jwt-js/commit/058a5623e9fad3ef37fd3b1a0627a98fa7b3d59e))
13 changes: 13 additions & 0 deletions docs/0.x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 0.x version Documentation

## Contents

- [sdjwt Instance & config](./sdjwt-instance.md)
- [Disclosure Frame](./disclosureframe.md)
- [Issue API](./issue.md)
- [Present API](./present.md)
- [Validation API](./validate.md)
- [Verify API](./verify.md)
- [Encode & Decode](./encode-decode.md)
- [Get Claims](./claims.md)
- [Key Binding](./keybinding.md)
7 changes: 7 additions & 0 deletions docs/0.x/claims.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Claims

You can get claims by using `getCliams` method

```ts
const claims = sdjwt.getClaims(encodedSdjwt);
```
Loading
Loading