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

core: Add changesets releases #395

Merged
merged 7 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": []
}
5 changes: 5 additions & 0 deletions .changeset/honest-elephants-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ui-core-react": patch
Copy link

Choose a reason for hiding this comment

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

Seems more like a feature, so Id put it in a minor version

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically I don't need a version for this, it was just to test the action

Copy link
Member Author

Choose a reason for hiding this comment

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

I will remove this changeset. It is a core change that doesn't need a version update

---

Add changeset release actions
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
30 changes: 30 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Action: 🦋 Changesets Release'
description: 'Release a new version of the package using changesets'

runs:
using: "composite"

steps:
- name: Enter prerelease mode
shell: sh
if: ${{ github.ref != 'refs/heads/main' }}
run: yarn prerelease:start

- name: Exit prerelease mode
shell: sh
if: ${{ github.ref == 'refs/heads/main' }}
run: yarn prerelease:end
HenriqueLimas marked this conversation as resolved.
Show resolved Hide resolved

- 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
HenriqueLimas marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/release
13 changes: 9 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,11 @@
"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",
"prerelease:end": "changeset pre exit || :",
"prerelease:start": "changeset pre enter next || :",
"prepare": "node scripts/husky-install || node ../scripts/husky-install",
"version": "yarn update-icons && git add -A src && changeset version"
Copy link

Choose a reason for hiding this comment

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

One issue we found was that when doing a release, the package-lock version does not get changed. By doing npm i --package-lock-only this will regenerate the package-lock version. That said, I don't know if theres an equivalent or similar problem for yarn.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does changeset changes the version of the lock file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see the issue now, although yarn.lock doesn't have the version of the package, only package-lock has it.

},
"lint-staged": {
"src/**/*.{ts,tsx}": [
Expand Down Expand Up @@ -138,6 +142,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
Loading