Skip to content

Commit

Permalink
Merge pull request #242 from ckb-cell/release/0.4.0
Browse files Browse the repository at this point in the history
Merge release/0.4.0 to main branch
  • Loading branch information
duanyytop authored Jun 20, 2024
2 parents 88050df + 0f2be64 commit b802eb1
Show file tree
Hide file tree
Showing 150 changed files with 6,929 additions and 2,317 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.git
.gitignore
*.md
tests
examples
dist
59 changes: 59 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Publish

on:
workflow_dispatch:
push:
branches:
- main
- develop
tags:
- v*.*.*

jobs:
docker-build-push:
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
context: git
images: ghcr.io/${{ github.repository }}-service
flavor: |
latest=auto
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=branch,suffix=-{{date 'YYYYMMDDHHmm'}}
type=sha,enable=true,prefix=sha-,format=short
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
target: service
push: true
provenance: false
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
32 changes: 27 additions & 5 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ name: Integration Tests

on:
workflow_dispatch:
pull_request:
# Run integration-tests every day
schedule:
- cron: '59 0 * * *'

# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
env_set: [ xudt, spore ]

steps:
- name: Checkout rgbpp-sdk
uses: actions/checkout@v4
Expand All @@ -33,12 +42,25 @@ jobs:
- name: Build packages
run: pnpm run build:packages


- name: Run integration:xudt script
working-directory: ./tests/rgbpp
if: ${{ matrix.env_set == 'xudt' }}
run: pnpm run integration:xudt
env:
VITE_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
VITE_SERVICE_URL: https://api.signet.rgbpp.io
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_PRIVATE_KEY }}
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_PRIVATE_KEY }}

- name: Run integration:spore script
working-directory: ./tests/rgbpp
if: ${{ matrix.env_set == 'spore' }}
run: pnpm run integration:spore
env:
VITE_SERVICE_URL: https://api.signet.rgbpp.io
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_SPORE_PRIVATE_KEY }}
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_SPORE_PRIVATE_KEY }}
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,29 @@ jobs:
run: pnpm i

- name: Create bump PR or release version
id: changesets
uses: changesets/action@v1
id: changesets
with:
publish: pnpm run release:packages
title: "bump: assumable rgbpp-sdk version"
commit: "bump: assumable rgbpp-sdk version"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create comment on commit
uses: actions/github-script@v7
if: steps.changesets.outputs.published
env:
PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
with:
script: |
const packages = JSON.parse(process.env.PACKAGES)
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`)
const body = ['New official version of the rgbpp-sdk packages have been released:', '| Name | Version |', '| --- | --- |', packagesTable].join('\n')
github.rest.repos.createCommitComment({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
29 changes: 18 additions & 11 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,29 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm
id: changesets
- name: Publish snapshot versions to npm
uses: changesets/action@v1
id: changesets
with:
publish: npx changeset publish --no-git-tag --snapshot --tag snap
publish: npx changeset publish --snapshot --tag snap
createGithubReleases: false
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create commit comment
uses: peter-evans/commit-comment@v3
if: ${{ steps.changesets.outputs.published == 'true' }}
- name: Create comment on commit
uses: actions/github-script@v7
if: steps.changesets.outputs.published
env:
PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
```json
${{ steps.changesets.outputs.publishedPackages }}
```
script: |
const packages = JSON.parse(process.env.PACKAGES)
const packagesTable = packages.map((p) => `| ${p.name} | \`${p.version}\` |`)
const body = ['New snapshot version of the rgbpp-sdk packages have been released:', '| Name | Version |', '| --- | --- |', packagesTable].join('\n')
github.rest.repos.createCommitComment({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test the functionality of the rgbpp-sdk packages.

name: Test
name: Unit Tests

on:
workflow_dispatch:
Expand Down Expand Up @@ -52,6 +52,6 @@ jobs:
- name: Run tests for packages
run: pnpm run test:packages
env:
VITE_BTC_SERVICE_URL: ${{ secrets.SERVICE_URL }}
VITE_BTC_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
VITE_BTC_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }}
VITE_BTC_SERVICE_URL: https://btc-assets-api.testnet.mibao.pro
VITE_BTC_SERVICE_TOKEN: ${{ secrets.TESTNET_SERVICE_TOKEN }}
VITE_BTC_SERVICE_ORIGIN: https://btc-assets-api.testnet.mibao.pro
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ devbox.json
devbox.lock
.envrc

# examples logs
examples/rgbpp/logs
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:20-slim AS base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack use pnpm@latest

COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN npm pkg delete scripts.prepare
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build

FROM base AS service
COPY --from=prod-deps /app/node_modules /node_modules
COPY --from=build /app/packages /app/packages
COPY --from=build /app/apps/service /app/apps/service

WORKDIR /app/apps/service
RUN pnpm add @nestjs/cli -D

ENV NODE_ENV=production
EXPOSE 3000
CMD [ "pnpm", "start" ]
2 changes: 0 additions & 2 deletions apps/next/.env.example

This file was deleted.

36 changes: 0 additions & 36 deletions apps/next/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions apps/next/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions apps/next/next.config.mjs

This file was deleted.

25 changes: 0 additions & 25 deletions apps/next/package.json

This file was deleted.

Binary file removed apps/next/src/app/favicon.ico
Binary file not shown.
19 changes: 0 additions & 19 deletions apps/next/src/app/layout.tsx

This file was deleted.

Loading

1 comment on commit b802eb1

@github-actions
Copy link

Choose a reason for hiding this comment

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

New official version of the rgbpp-sdk packages have been released:

Name Version
@rgbpp-sdk/btc 0.4.0

Please sign in to comment.