Skip to content

Commit

Permalink
core: Add changesets releases (#395)
Browse files Browse the repository at this point in the history
* core: Add changesets releases

* Add storybook on PR and remove unucessary conditions

* Remove permissions

* Make deploy and analyze parallel

* Pass branch name

* Remove prerelease scripts

* Remove changeset file
  • Loading branch information
HenriqueLimas authored Jan 14, 2025
1 parent 9f2bece commit 1ed821f
Show file tree
Hide file tree
Showing 8 changed files with 515 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "ebay/ebayui-core-react"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
26 changes: 26 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Action: Deploy Storybook'
description: 'Composite storybook deploy action'

inputs:
branch:
description: branch name
required: false
default: main

runs:
using: "composite"
steps:
- name: Build Storybook
shell: sh
run: NODE_OPTIONS=--openssl-legacy-provider yarn build-storybook --output-dir storybook-static/${{ inputs.branch }}

- name: Publish Storybook
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: storybook-static
clean: false

- name: Output storybook link
shell: sh
run: |
echo "Storybook published: https://opensource.ebay.com/ebayui-core-react/${{ inputs.branch }}/index.html" >> $GITHUB_STEP_SUMMARY
20 changes: 20 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Action: 🦋 Changesets Release'
description: 'Release a new version of the package using changesets'

runs:
using: "composite"

steps:
- name: Release
id: changesets
uses: changesets/action@v1
with:
version: yarn version
publish: yarn release
commit: "ci: release"
title: "ci: release"
env:
# Disable husky
HUSKY: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/analyze
deploy:
name: Deploy
needs: build-test
runs-on: ubuntu-latest
# Deploy storybook only on branches, ignoring forks
if: "${{ github.repository_owner == 'ebay' }}"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/deploy
with:
branch: ${{ github.head_ref }}
23 changes: 23 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,26 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/build
deploy:
needs: build
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/deploy
release:
needs: deploy
name: Release
# Sets permissions of the GITHUB_TOKEN to allow opening release PR
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
issues: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/release
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "7.4.0",
"description": "Skin components build off React",
"publishConfig": {
"registry": "https://registry.npmjs.org"
"registry": "https://registry.npmjs.org",
"directory": "dist"
},
"exports": {
"./ebay-dialog-base/components/animation": {
Expand Down Expand Up @@ -87,6 +88,7 @@
"lint": "eslint . --ext ts,tsx",
"lint:ci": "eslint . --ext .ts,.tsx -f @microsoft/eslint-formatter-sarif -o eslint-results.sarif",
"coverage": "yarn clean && yarn test --coverage --ci",
"change": "changeset add",
"eslint-local": "eslint . --ext ts,tsx",
"eslint": "eslint . --ext .ts,.tsx -f checkstyle -o ./lint/checkstyle-result.xml",
"format": "eslint . --fix 'src/**/*.{ts,tsx}'",
Expand All @@ -100,9 +102,9 @@
"update-icons": "node ./scripts/update-icons",
"copy": "copyfiles package.json README.md dist; yarn copy:rest",
"copy:rest": "yarn copyfiles -u 1 'src/**/*.md' dist",
"release": "yarn clean && yarn build && yarn copy && CI=1 npm publish dist/ --access public",
"release:rc": "yarn clean && yarn build && yarn copy && CI=1 npm publish --tag rc dist/",
"prepare": "node scripts/husky-install || node ../scripts/husky-install"
"release": "yarn clean && yarn build && yarn copy && CI=1 changeset publish",
"prepare": "node scripts/husky-install || node ../scripts/husky-install",
"version": "yarn update-icons && git add -A src && changeset version"
},
"lint-staged": {
"src/**/*.{ts,tsx}": [
Expand Down Expand Up @@ -138,6 +140,7 @@
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.0.0",
"@changesets/cli": "^2.27.11",
"@ebay/skin": "^18.4.0",
"@microsoft/eslint-formatter-sarif": "^3.0.0",
"@rollup/plugin-typescript": "^11.1.6",
Expand Down
Loading

0 comments on commit 1ed821f

Please sign in to comment.