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

chore(release): switch from msr to changesets #2362

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
18 changes: 8 additions & 10 deletions .github/workflows/pr.yaml → .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: Pull request
name: Pull Request - Builds

on: pull_request

env:
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }}
TURBO_SCM_HEAD: ${{ github.sha }}

concurrency:
group: push
cancel-in-progress: false

jobs:
test:
name: Test-build with Node.js ${{ matrix.node-version }}
build:
name: Build with Node.js ${{ matrix.node-version }}
schultzp2020 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -30,16 +34,10 @@ jobs:
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1

- name: Install dependencies
shell: bash
run: |
yarn install

- name: Test
uses: ./.github/actions/test
with:
args: --affected

- name: Build all packages
- name: Build packages
uses: ./.github/actions/build
with:
args: --affected
47 changes: 47 additions & 0 deletions .github/workflows/pr-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Pull Request - Tests

on: pull_request

env:
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }}
TURBO_SCM_HEAD: ${{ github.sha }}

concurrency:
group: push
cancel-in-progress: false

jobs:
test:
name: Test with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'

- name: Setup local Turbo cache
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1

- name: Install dependencies
run: |
yarn install

- name: Verify changesets
run: |
yarn changeset status --since=${{ github.event.pull_request.base.sha }}

- name: Test packages
uses: ./.github/actions/test
with:
args: --affected
36 changes: 21 additions & 15 deletions .github/workflows/push.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push
name: Release Packages

on:
workflow_dispatch:
Expand All @@ -9,23 +9,24 @@ on:
default: 'warning'
push:
branches:
# since we use multi-semantic-release, which assumes that all plugins in the 1.1.x branch
# are versioned < 1.2, we can only release from main branch. See RHIDP-1720 for more info
- main
# TODO: Remove once 1.2.x is deprecated
- 1.2.x
- release-[0-9].[0-9]*

concurrency:
group: push
cancel-in-progress: false

jobs:
test:
name: Release
release:
name: Release Packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
# don't persist the GITHUB_TOKEN
# so that semantic-release can use use the generated token
# don't persist the GITHUB_TOKEN so the release can use use the generated token
persist-credentials: false

- name: Generate token
Expand All @@ -44,19 +45,24 @@ jobs:
- name: Install dependencies
shell: bash
run: |
yarn install
yarn install --frozen-lockfile

- name: Build all packages
# We are required to build every plugin for MSR
uses: ./.github/actions/build

- name: Release via semantic-release
- name: Creating .npmrc
run: |
echo -n "Loading tags... ";tagsFound="$(git fetch --tags 2>&1)"; echo "found $(echo "$tagsFound" | wc -l) tags."
npm config set workspaces-update false
yarn release --ignore-private-packages
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: yarn changeset publish
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_OPTIONS: '--max-old-space-size=8192'
79 changes: 3 additions & 76 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"prettier:check": "turbo run prettier:check",
"prettier:fix": "turbo run prettier:check",
"new": "janus-cli new --do-not-edit-packages",
"release": "multi-semantic-release",
"prepare": "husky install",
"export-dynamic": "turbo run export-dynamic",
"versions:bump": "backstage-cli versions:bump && find . -name 'package.json' ! -path '*/node_modules/*' -exec sed -i -e '/devDependencies/,/\\\\}/{ s/\\\"\\\\^/\\\"/; }' {} ; && yarn install && yarn run export-dynamic --no-cache -- -- --clean"
Expand All @@ -44,94 +43,22 @@
"@backstage/cli": "0.26.11",
"@ianvs/prettier-plugin-sort-imports": "4.2.1",
"@janus-idp/cli": "*",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semrel-extra/npm": "1.2.2",
"@spotify/prettier-config": "15.0.0",
"conventional-changelog-conventionalcommits": "6.1.0",
"eslint-plugin-jest": "27.9.0",
"husky": "8.0.3",
"lint-staged": "15.2.7",
"multi-semantic-release": "3.0.2",
"turbo": "2.1.3",
"typescript": "5.4.5"
"typescript": "5.4.5",
"@changesets/cli": "2.27.9"
},
"resolutions": {
"@types/react": "^18",
"@types/react-dom": "^18",
"react": "^18",
"react-dom": "^18",
"vscode-languageserver-types": "3.17.5",
"@typescript-eslint/typescript-estree": "^7.3.1",
"@babel/core": "7.24.9",
"@babel/traverse": "7.24.8",
"@babel/generator": "7.24.10",
"dset": "^3.1.4"
"react-dom": "^18"
},
"jest": {
"testTimeout": 15000
},
"release": {
"branches": "main",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "docs",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "perf",
"release": "minor"
},
{
"scope": "no-release",
"release": false
},
{
"type": "chore",
"scope": "deps",
"release": "patch"
}
]
}
],
"@semantic-release/changelog",
"@semrel-extra/npm",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json",
"dist-dynamic/package.json",
"dist-dynamic/yarn.lock"
]
}
],
[
"@semantic-release/github",
{
"successComment": false,
"releasedLabels": false
}
],
[
"@semantic-release/exec",
{
"successCmd": "if [ -d 'dist-dynamic' ]; then echo 'publishing backend derived package ...' && cd dist-dynamic && npm pkg delete scripts && npm publish --registry https://registry.npmjs.org/ --access public ; fi"
}
]
]
},
"packageManager": "yarn@1.22.22"
}
Loading