Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/witty-flies-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alauda/ui": patch
---

chore: migrate npm publishing to trusted publishing and Node 22
35 changes: 0 additions & 35 deletions .github/workflows/release-beta.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/release-prod.yml

This file was deleted.

43 changes: 36 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,43 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
inputs:
version:
description: Hotfix package version for prod, 5.7.0-prod-3.5-0 for example.
required: true

permissions:
contents: write
id-token: write

jobs:
release:
name: Release
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
cache: yarn
registry-url: 'https://registry.npmjs.org'
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
if: github.event_name == 'push'
id: changesets
uses: changesets/action@v1
with:
Expand All @@ -39,7 +50,25 @@ jobs:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release beta
Comment thread
JounQin marked this conversation as resolved.
if: github.event_name == 'pull_request'
run: sh scripts/release.sh
env:
PUBLISH_VERSION: beta
Comment thread
JounQin marked this conversation as resolved.

- name: Set git info
if: github.event_name == 'workflow_dispatch'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Release prod
if: github.event_name == 'workflow_dispatch'
run: sh scripts/release.sh
env:
PUBLISH_VERSION: ${{ github.event.inputs.version }}

- name: Sync Cnpm
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && steps.changesets.outputs.published == 'true')
run: npx cnpm sync @alauda/ui
6 changes: 3 additions & 3 deletions .github/workflows/stories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22.14.0
cache: yarn

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22.14.0
cache: yarn

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
10 changes: 3 additions & 7 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#!/bin/sh

set -e

PUBLISH_VERSION=$(node scripts/publish-version)
PUBLISH_BRANCH=$(node scripts/publish-branch)
NPM_TAG=$(node scripts/npm-tag)

if [ "$NODE_AUTH_TOKEN" = "" ] && [ "$NPM_TOKEN" = "" ]; then
echo "NPM_TOKEN is not available on PR from forked repository!"
echo "If you're a member of Alauda, just checkout a new branch instead."
exit 0
fi

if [ "$NPM_TAG" = "latest" ]; then
echo "Publish latest tag via this script is not permitted anymore."
exit 1
Expand All @@ -26,4 +22,4 @@ if [ "$PUBLISH_BRANCH" != "" ]; then
git push --follow-tags origin "$PUBLISH_BRANCH"
fi

npm publish ./release --tag "$NPM_TAG" --provenance --access public
npm publish ./release --tag "$NPM_TAG" --access public
Loading