Skip to content

Commit

Permalink
ci: add goole release-please and github action (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm authored Oct 28, 2024
1 parent 3c67638 commit 25d8f74
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 6 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
on:
push:
branches:
- main

concurrency:
group: "release-${{ github.ref }}"
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

name: Run Release Please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
sdk-core--tag_name: ${{ steps.release.outputs['packages/sdk-core--tag_name']}}
sdk-core--release_created: ${{ steps.release.outputs['packages/sdk-core--release_created']}}
sdk-react-hooks--tag_name: ${{ steps.release.outputs['packages/sdk-react-hooks--tag_name']}}
sdk-react-hooks--release_created: ${{ steps.release.outputs['packages/sdk-react-hooks--release_created']}}
sdk-react-ui--tag_name: ${{ steps.release.outputs['packages/sdk-react-ui--tag_name']}}
sdk-react-ui--release_created: ${{ steps.release.outputs['packages/sdk-react-ui--release_created']}}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
token: ${{secrets.GITHUB_TOKEN}}
- name: Print release outputs for debugging
continue-on-error: true
run: |
echo "Release outputs:"
echo "${{ toJson(steps.release.outputs) }}"
release-sdk-core:
needs: release-please
if: ${{needs.release-please.outputs.sdk-core--release_created}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Build Packages
working-directory: ./packages/sdk-core
run: |
pnpm install
pnpm build
- name: Publish to NPM
working-directory: ./packages/sdk-core
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: pnpm publish

release-sdk-react-hooks:
needs: release-please
if: ${{needs.release-please.outputs.sdk-react-hooks--release_created}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Build Packages
working-directory: ./packages/sdk-react-hooks
run: |
pnpm install
pnpm build
- name: Publish to NPM
working-directory: ./packages/sdk-react-hooks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: pnpm publish

release-sdk-react-ui:
needs: release-please
if: ${{needs.release-please.outputs.sdk-react-ui--release_created}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Build Packages
working-directory: ./packages/sdk-react-ui
run: |
pnpm install
pnpm build
- name: Publish to NPM
working-directory: ./packages/sdk-react-ui
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: pnpm publish
5 changes: 5 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packages/sdk-core": "1.0.0-alpha.5",
"packages/sdk-react-hooks": "1.0.0-alpha.6",
"packages/sdk-react-ui": "1.0.0-alpha.5"
}
4 changes: 2 additions & 2 deletions packages/sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atm0s-media-sdk/core",
"version": "1.0.0-alpha.4",
"version": "1.0.0-alpha.5",
"main": "./dist/lib.js",
"module": "./dist/lib.mjs",
"types": "./dist/lib.d.ts",
Expand All @@ -27,4 +27,4 @@
"build": "tsup src/lib.ts --format cjs,esm --dts",
"dev": "tsup src/lib.ts --format cjs,esm --dts --watch"
}
}
}
4 changes: 2 additions & 2 deletions packages/sdk-react-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atm0s-media-sdk/react-hooks",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.6",
"main": "./dist/lib.js",
"module": "./dist/lib.mjs",
"types": "./dist/lib.d.ts",
Expand Down Expand Up @@ -31,4 +31,4 @@
"build": "tsup src/lib.tsx --format cjs,esm --dts",
"dev": "tsup src/lib.tsx --format cjs,esm --dts --watch"
}
}
}
4 changes: 2 additions & 2 deletions packages/sdk-react-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atm0s-media-sdk/react-ui",
"version": "1.0.0-alpha.4",
"version": "1.0.0-alpha.5",
"main": "./dist/lib.js",
"module": "./dist/lib.mjs",
"types": "./dist/lib.d.ts",
Expand Down Expand Up @@ -35,4 +35,4 @@
"dev": "tsup src/lib.tsx --format cjs,esm --dts --watch",
"generate:component": "turbo gen react-component"
}
}
}
24 changes: 24 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"include-component-in-tag": true,
"tag-separator": "@",
"release-type": "node",
"separate-pull-requests": true,
"plugins": [
{
"type": "node-workspace",
"updatePeerDependencies": true
}
],
"packages": {
"packages/sdk-core": {
"package-name": "@atm0s-media-sdk/core"
},
"packages/sdk-react-hooks": {
"package-name": "@atm0s-media-sdk/react-hooks"
},
"packages/sdk-react-ui": {
"package-name": "@atm0s-media-sdk/react-ui"
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

0 comments on commit 25d8f74

Please sign in to comment.