-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
188 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: '👷 Build Design System' | ||
inputs: | ||
build: | ||
description: 'Build packages' | ||
default: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'baopso' | ||
git config --global user.email '[email protected]' | ||
git remote set-url origin https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Stetup Node.JS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Update NPM registry path | ||
run: npm run registry | ||
|
||
- name: Clean install | ||
run: npm ci | ||
|
||
- name: Define Nx cache | ||
uses: nrwl/nx-set-shas@v4 | ||
|
||
- name: Check format | ||
run: npx nx format:check | ||
|
||
- name: Check spelling | ||
run: npm run spell | ||
|
||
- name: Lint & Test | ||
if: inputs.build == 'false' | ||
run: npx nx run-many -t lint test | ||
|
||
- name: Lint & Test & Build | ||
if: inputs.build == 'true' | ||
run: npx nx run-many -t lint test build | ||
|
||
- name: Releae dry-run | ||
if: inputs.build == 'true' | ||
run: npx nx release publish -d | ||
|
||
- name: Upload E2E artifacts | ||
if: inputs.build == 'true' | ||
uses: ./.github/workflows/actions/upload-archive | ||
with: | ||
name: test-e2e | ||
output: test/TestE2eBuild.zip | ||
paths: test/generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: 'Archive Upload' | ||
description: 'Compresses and uploads an archive to be reused across jobs' | ||
inputs: | ||
paths: | ||
description: 'Paths to files or directories to archive' | ||
output: | ||
description: 'Output file name' | ||
name: | ||
description: 'Archive name' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Create Archive | ||
run: zip -q -r ${{ inputs.output }} ${{ inputs.paths }} | ||
shell: bash | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.name }} | ||
path: ${{ inputs.output }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,121 +6,23 @@ on: | |
- main | ||
- changeset-release/main | ||
pull_request: | ||
branches: ['**'] | ||
types: [opened, synchronize, reopened] | ||
merge_group: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
main: | ||
name: 👷 CI | ||
build: | ||
name: 👷 Build Design System | ||
runs-on: ubuntu-latest | ||
env: | ||
HUSKY: 0 | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
- name: 👷 Build Design System | ||
uses: ./.github/workflows/actions/build | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Stetup Node.JS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Update NPM registry path | ||
run: npm run registry | ||
|
||
- name: Clean install | ||
run: npm ci | ||
|
||
- name: Define Nx cache | ||
uses: nrwl/nx-set-shas@v4 | ||
|
||
# - name: Prepare build | ||
# run: npx nx run-many -t prepare | ||
|
||
- name: Check format | ||
run: npx nx format:check | ||
|
||
- name: Check spelling | ||
run: npm run spell | ||
|
||
- name: Lint & test | ||
run: npx nx run-many -t lint test | ||
# run: npx nx affected -t lint test | ||
|
||
- name: Changeset | ||
if: github.ref == 'refs/heads/main' | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
publish: npx nx run-many -t build | ||
env: | ||
HUSKY_DISABLED: 1 | ||
BAL_DS_RELEASE: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
||
- name: Changeset outputs | ||
shell: bash | ||
run: | | ||
echo "Changeset published - ${{ steps.changesets.outputs.published }}" | ||
echo "Changeset publishedPackages - ${{ steps.changesets.outputs.publishedPackages }}" | ||
echo "Changeset hasChangesets - ${{ steps.changesets.outputs.hasChangesets }}" | ||
echo "Changeset pullRequestNumber - ${{ steps.changesets.outputs.pullRequestNumber }}" | ||
- name: Build | ||
if: steps.changesets.outputs.published == 'false' | ||
run: npx nx run-many -t build | ||
# run: npx nx affected -t build | ||
|
||
- name: Releae dry-run | ||
if: github.ref == 'refs/heads/main' && steps.changesets.outputs.hasChangesets == 'true' && steps.changesets.outputs.published == 'false' | ||
run: npx nx release publish -d | ||
|
||
# - name: Update lock file | ||
# if: steps.changesets.outputs.published == 'true' | ||
# run: npm install | ||
# shell: bash | ||
|
||
# - name: Commit lock file | ||
# if: steps.changesets.outputs.published == 'true' | ||
# uses: EndBug/add-and-commit@v9 | ||
# with: | ||
# add: 'package-lock.json' | ||
# message: 'chore(): update lock file' | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# - name: Tag release | ||
# if: steps.changesets.outputs.published == 'true' | ||
# uses: thejeff77/[email protected] | ||
# with: | ||
# tag: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
# message: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
|
||
# - name: Update changelog file | ||
# if: steps.changesets.outputs.published == 'true' | ||
# run: awk 'NR==1 {print "# Changelog"} NR!=1' packages/tokens/CHANGELOG.md > CHANGELOG.md | ||
# shell: bash | ||
|
||
# - name: Commit changelog | ||
# if: steps.changesets.outputs.published == 'true' | ||
# uses: EndBug/add-and-commit@v9 | ||
# with: | ||
# add: 'CHANGELOG.md' | ||
# message: 'chore(): update changelog' | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# - name: Merge main -> production | ||
# if: steps.changesets.outputs.published == 'true' | ||
# uses: devmasx/merge-branch@master | ||
# with: | ||
# type: now | ||
# from_branch: main | ||
# target_branch: production | ||
# message: ':bookmark: release: ${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
build: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Release: | ||
name: 🚀 Release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
env: | ||
HUSKY: 0 | ||
steps: | ||
- name: 👷 Build Design System | ||
uses: ./.github/workflows/actions/build | ||
with: | ||
build: false | ||
|
||
- uses: ./.github/workflows/actions/setup-release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
npm-token: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
publish: npm run release | ||
env: | ||
HUSKY_DISABLED: 1 | ||
BAL_DS_RELEASE: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
||
- name: Echo Changeset output | ||
shell: bash | ||
run: | | ||
echo "Changeset published - ${{ steps.changesets.outputs.published }}" | ||
echo "Changeset publishedPackages - ${{ steps.changesets.outputs.publishedPackages }}" | ||
echo "Changeset hasChangesets - ${{ steps.changesets.outputs.hasChangesets }}" | ||
echo "Changeset pullRequestNumber - ${{ steps.changesets.outputs.pullRequestNumber }}" | ||
- name: Update lock file | ||
if: steps.changesets.outputs.published == 'true' | ||
run: npm install | ||
shell: bash | ||
|
||
- name: Commit lock file | ||
if: steps.changesets.outputs.published == 'true' | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'package-lock.json' | ||
message: 'chore(): update lock file' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Tag release | ||
if: steps.changesets.outputs.published == 'true' | ||
uses: thejeff77/[email protected] | ||
with: | ||
tag: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
message: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
|
||
- name: Update changelog file | ||
if: steps.changesets.outputs.published == 'true' | ||
run: awk 'NR==1 {print "# Changelog"} NR!=1' packages/components/CHANGELOG.md > CHANGELOG.md | ||
shell: bash | ||
|
||
- name: Commit changelog | ||
if: steps.changesets.outputs.published == 'true' | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'CHANGELOG.md' | ||
message: 'chore(): update changelog' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Merge main -> production | ||
if: steps.changesets.outputs.published == 'true' | ||
uses: devmasx/merge-branch@master | ||
with: | ||
type: now | ||
from_branch: main | ||
target_branch: production | ||
message: ':bookmark: release: ${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ e2e/cypress/snapshots | |
e2e/cypress/videos | ||
|
||
package-lock.json | ||
*.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters