Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
6eb8613
sketch out GHA
dreamwasp Jun 4, 2025
ccc1ce0
very sketchy
dreamwasp Jun 4, 2025
edc7837
not this
dreamwasp Jun 4, 2025
72e7e51
converted alphas over to GHA
dreamwasp Jun 4, 2025
aeebdf6
convert circleci vars to gh vars
dreamwasp Jun 4, 2025
6407338
fix the things
dreamwasp Jun 4, 2025
00b5042
remove version check
dreamwasp Jun 4, 2025
a504392
format project.json
dreamwasp Jun 4, 2025
8beb2c7
try removing parallel
dreamwasp Jun 5, 2025
19a927b
test errors on npm token
dreamwasp Jun 5, 2025
2771e7d
put back npm token
dreamwasp Jun 5, 2025
0278e05
here goes nothin;
dreamwasp Jun 5, 2025
4a62c4b
try adding auth token
dreamwasp Jun 5, 2025
d614efe
put back
dreamwasp Jun 5, 2025
e5bc987
remove
dreamwasp Jun 5, 2025
163bba4
fix npm token
dreamwasp Jun 5, 2025
3cded02
fix npm token
dreamwasp Jun 5, 2025
96acaea
figure out npm issue
dreamwasp Jun 5, 2025
ad48e6f
try changes w/ cache?
dreamwasp Jun 6, 2025
b8525fa
tweak lerna command
dreamwasp Jun 6, 2025
ac8cc88
Merge branch 'main' into cass-gm-549
dreamwasp Jun 6, 2025
110be8f
fix detached head in lerna
dreamwasp Jun 6, 2025
eb27ba1
update checkout actions
dreamwasp Jun 6, 2025
92c53d0
fix head-ref
dreamwasp Jun 6, 2025
197d36b
remove other publish_alpha action;
dreamwasp Jun 6, 2025
018b2ee
REMOVE publish alpha
dreamwasp Jun 6, 2025
34fc0a7
Merge branch 'main' into cass-gm-549
dreamwasp Jun 10, 2025
fa3ce48
test removing github sha
dreamwasp Jun 10, 2025
c685734
more test
dreamwasp Jun 10, 2025
ed85405
test env change
dreamwasp Jun 10, 2025
ff533ff
test npm token
dreamwasp Jun 10, 2025
80de185
deploy alpha draft
dreamwasp Jun 11, 2025
8fddd3f
test deploy-alpha
dreamwasp Jun 11, 2025
9b8a63c
remove deploy alpha from circleci action
dreamwasp Jun 11, 2025
5ef96da
remove echos
dreamwasp Jun 11, 2025
0203118
update netlify-cli
dreamwasp Jun 11, 2025
c17a1e6
actually upd8 versions
dreamwasp Jun 11, 2025
8c35e95
install first?
dreamwasp Jun 11, 2025
8d73d3e
lol
dreamwasp Jun 11, 2025
de5de7d
downgrade to more stable version
dreamwasp Jun 11, 2025
cf040da
try out netlify-action
dreamwasp Jun 11, 2025
6fd282a
Revert "try out netlify-action"
dreamwasp Jun 11, 2025
e23bd1c
try adding site id
dreamwasp Jun 11, 2025
f5e4c9c
Merge branch 'main' into cass-gm-549
dreamwasp Jun 11, 2025
76e0562
try adding back install netlify
dreamwasp Jun 11, 2025
596bc0b
fix npm token
dreamwasp Jun 11, 2025
83ed3b4
move npm token to workflow
dreamwasp Jun 11, 2025
c9990ee
who am i
dreamwasp Jun 11, 2025
107a118
who am i
dreamwasp Jun 11, 2025
5f282f3
remove npm auth check
dreamwasp Jun 11, 2025
5be40bd
refactor npm token
dreamwasp Jun 11, 2025
8f79317
remove out of yarn workflow for now
dreamwasp Jun 11, 2025
9ecb19c
test alpha
dreamwasp Jun 11, 2025
e769b80
fix typo
dreamwasp Jun 11, 2025
9819c13
swap some env vars
dreamwasp Jun 11, 2025
04d7ebe
remove seperate install
dreamwasp Jun 11, 2025
d7de5a9
try netlify link
dreamwasp Jun 11, 2025
de40ecd
try swapping deploy output
dreamwasp Jun 11, 2025
0f292b5
remove sit_id;
dreamwasp Jun 11, 2025
0fe1e62
pair with jake tomorrow
dreamwasp Jun 11, 2025
e295ef5
test new site ID
dreamwasp Jun 11, 2025
016d738
test static deploy
dreamwasp Jun 11, 2025
38d53c7
test with proper github variables
dreamwasp Jun 11, 2025
1c2df83
put that back
dreamwasp Jun 11, 2025
899e4e1
add npm_token
dreamwasp Jun 12, 2025
fea7933
add fi
dreamwasp Jun 12, 2025
4711518
no npm_token
dreamwasp Jun 12, 2025
180429b
fix typo
dreamwasp Jun 12, 2025
09c2aa0
fix multiline output
dreamwasp Jun 12, 2025
0393e93
try different grep command
dreamwasp Jun 12, 2025
1c0358e
Merge branch 'main' into cass-gm-549
dreamwasp Jun 12, 2025
eaf5160
try new line
dreamwasp Jun 12, 2025
1d93da8
sed again
dreamwasp Jun 12, 2025
638d7ed
add closing quote
dreamwasp Jun 12, 2025
892da65
try awk method
dreamwasp Jun 12, 2025
3b6fa02
remove code line just in case
dreamwasp Jun 12, 2025
0fb0195
preserve line breaks
dreamwasp Jun 12, 2025
7582bcb
replace semi-colon with @ for versions
dreamwasp Jun 12, 2025
fca2788
Merge branch 'main' into cass-gm-549
dreamwasp Jun 18, 2025
5ab9b4b
Merge branch 'main' into cass-gm-549
dreamwasp Sep 24, 2025
7da568d
test deploy
dreamwasp Sep 24, 2025
cd3dce3
explicitely link id
dreamwasp Sep 24, 2025
7fd5fde
alpha
dreamwasp Sep 24, 2025
627c68b
filter
dreamwasp Sep 24, 2025
9991173
try site id
dreamwasp Sep 24, 2025
7d337e4
alpha
dreamwasp Sep 24, 2025
1938822
try
dreamwasp Sep 24, 2025
27fc1c5
again
dreamwasp Sep 24, 2025
3c330fc
try using latest
dreamwasp Sep 24, 2025
bc12558
here goes nothing
dreamwasp Sep 24, 2025
b3f9500
tweak
dreamwasp Sep 24, 2025
4895f36
tweak
dreamwasp Sep 24, 2025
646ac37
another go;
dreamwasp Sep 24, 2025
e5cfb38
Merge branch 'main' into cass-gm-549
dreamwasp Oct 8, 2025
4c5b667
this branch
dreamwasp Oct 8, 2025
3dc6cbd
debug
dreamwasp Oct 8, 2025
13f864a
api approach
dreamwasp Oct 8, 2025
1509002
better netify link
dreamwasp Oct 8, 2025
a507fe2
netfliy cli again
dreamwasp Oct 8, 2025
0a19c46
try circleCi
dreamwasp Oct 8, 2025
15cff54
test netlify status
dreamwasp Oct 8, 2025
0704f86
test status
dreamwasp Oct 8, 2025
9992a35
filter
dreamwasp Oct 8, 2025
70916af
explicit link in line
dreamwasp Oct 8, 2025
008e8c4
combo
dreamwasp Oct 8, 2025
0287fab
duped filter
dreamwasp Oct 8, 2025
55b7a50
unlink from undefined
dreamwasp Oct 8, 2025
dba0661
filter all commands
dreamwasp Oct 8, 2025
fb89581
deploy alpha
dreamwasp Oct 8, 2025
255f707
try filter for site list
dreamwasp Oct 8, 2025
ad86c4d
git push
dreamwasp Oct 8, 2025
9443d18
explict auth
dreamwasp Oct 8, 2025
dbc085b
test unlink
dreamwasp Oct 8, 2025
e1f7886
try test
dreamwasp Oct 8, 2025
f474ae5
start over
dreamwasp Oct 8, 2025
14e17ff
remover state.json
dreamwasp Oct 8, 2025
ac05039
more testing
dreamwasp Oct 8, 2025
20adb4f
try this
dreamwasp Oct 8, 2025
6676f95
auth step
dreamwasp Oct 8, 2025
1693764
direct site
dreamwasp Oct 8, 2025
1c493d9
back to circle
dreamwasp Oct 8, 2025
f211ffa
try monorepo fix
dreamwasp Oct 8, 2025
07e39fc
try again
dreamwasp Oct 8, 2025
0d02d1e
explicit config
dreamwasp Oct 8, 2025
e9b44f8
debug tokens
dreamwasp Oct 8, 2025
fd4ef44
auth
dreamwasp Oct 8, 2025
49400c2
see if this works
dreamwasp Oct 8, 2025
6618097
try without linking
dreamwasp Oct 8, 2025
a65c05a
fix await
dreamwasp Oct 8, 2025
f2c93f5
workaround fix for top level await
dreamwasp Oct 8, 2025
490d284
pinned version
dreamwasp Oct 8, 2025
0fab94b
avoid netlify user input
dreamwasp Oct 8, 2025
a900a30
auth
dreamwasp Oct 8, 2025
5bfaf44
try
dreamwasp Oct 8, 2025
ad84ae0
process GHA output
dreamwasp Oct 9, 2025
1401a93
swap to grep
dreamwasp Oct 9, 2025
190300a
swap to sticky-pull-request
dreamwasp Oct 9, 2025
8c0338e
grep to sed
dreamwasp Oct 9, 2025
1e82c1a
again
dreamwasp Oct 9, 2025
8441ac8
keep formatting
dreamwasp Oct 9, 2025
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
64 changes: 5 additions & 59 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ references:
default_env: &default_env
docker:
- image: cimg/node:22.13.1
working_directory: ~/repo
working_directory: ~/repo # not required?
environment:
IGNORE_COMMIT_MESSAGE: 'chore(release): publish'
NODE_OPTIONS: '--max_old_space_size=8196'
Expand Down Expand Up @@ -67,15 +67,15 @@ references:
- packages

restore_node_modules: &restore_node_modules
attach_workspace:
attach_workspace: #The attach_workspace copies and re-creates the entire workspace content when it runs.
at: ~/repo

build_all_packages: &build_all_packages
run:
name: Build All Packages
command: yarn build

set_git_user: &set_git_user
set_git_user: &set_git_user # move to yarn actikon maybe
run:
name: Set git user
command: |
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
checkout_code:
<<: *default_env
steps:
- checkout
- checkout # circle keyword
- *set_npm_token
- *restore_yarn_cache
- run: yarn --production=false --frozen-lockfile
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
name: deploy
command: |
DEPLOY_MESSAGE="User: ${CIRCLE_USERNAME} Project: ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} Pull Request: ${CIRCLE_PULL_REQUEST}"
npx netlify-cli@17.37.1 deploy --message "${DEPLOY_MESSAGE}" --dir dist/storybook/styleguide --json --filter @codecademy/styleguide > .deploy-output
npx netlify-cli@22.1.3 deploy --message "${DEPLOY_MESSAGE}" --dir dist/storybook/styleguide --json --filter @codecademy/styleguide > .deploy-output
- setup_remote_docker
- run: docker pull cloudposse/github-commenter:0.5.0-58
- run:
Expand All @@ -224,44 +224,6 @@ jobs:
cloudposse/github-commenter:0.5.0-58
fi

publish_alpha:
<<: *default_env
resource_class: large
steps:
- *skip_if_not_pr
- *skip_on_automated_commit
- *set_git_user
- checkout
- *restore_node_modules
- *set_npm_token
- *restore_nx_cache
- *build_all_packages
- *save_nx_cache
- run:
name: lerna publish (alpha)
command: yarn lerna publish --exact --yes --include-merged-tags --no-push --no-git-reset --conventional-commits --conventional-prerelease --preid=alpha.${CIRCLE_SHA1:0:6} --dist-tag=alpha.${CIRCLE_SHA1:0:6}
- setup_remote_docker
- run: docker pull cloudposse/github-commenter:0.5.0-58
- run:
name: Comment
command: |
ALPHA_PACKAGES="$(yarn lerna ll --parseable | grep alpha || true)"
if [ -z "$ALPHA_PACKAGES" ]
then
echo "No alpha published packages found, will not add PR comment"
else
docker run --rm \
-e GITHUB_TOKEN \
-e GITHUB_OWNER="${CIRCLE_PROJECT_USERNAME}" \
-e GITHUB_REPO="${CIRCLE_PROJECT_REPONAME}" \
-e GITHUB_COMMENT_TYPE=pr \
-e GITHUB_PR_ISSUE_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" \
-e GITHUB_COMMENT_TEMPLATE='<h3>📬Published Alpha Packages:</h3><pre>{{$x := splitList "\n" .}}{{range $x}}{{$y := split ":" .}}{{printf "%s@%v<br/>" $y._1 $y._2}}{{end}}</pre><!--LERNA_VERSION_COMMENT-->' \
-e GITHUB_DELETE_COMMENT_REGEX="LERNA_VERSION_COMMENT" \
-e GITHUB_COMMENT="${ALPHA_PACKAGES}" \
cloudposse/github-commenter:0.5.0-58
fi

workflows:
version: 2
build-test:
Expand All @@ -281,14 +243,6 @@ workflows:
filters:
branches:
only: main
- publish_alpha:
filters:
branches:
ignore:
- main
- gh-pages
requires:
- checkout_code

deploy:
jobs:
Expand All @@ -304,11 +258,3 @@ workflows:
filters:
branches:
only: main
- deploy_alpha:
filters:
branches:
ignore:
- main
- gh-pages
requires:
- checkout_code
14 changes: 14 additions & 0 deletions .github/actions/yarn/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Setup Node & yarn'
description: 'Setup a NodeJS environment, install deps, & builds packages'

runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610
with:
node-version-file: .nvmrc

- name: Install dependencies
shell: bash
run: yarn --production=false --frozen-lockfile
127 changes: 127 additions & 0 deletions .github/workflows/deploy-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Deploy Storybook Preview

on:
pull_request:
branches-ignore:
- main
- gh-pages

env:
NODE_VERSION: '22.13.1'
NODE_OPTIONS: '--max_old_space_size=8196'
NX_CLOUD: false
IGNORE_COMMIT_MESSAGE: 'chore(release): publish'

permissions:
id-token: write
contents: read
pull-requests: write
issues: write

jobs:
deploy-alpha:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Add NPM auth token file
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: Install dependencies
run: yarn --production=false --frozen-lockfile

- name: Ensure workflow is associated with a pull request
run: |
if [[ -z "${{ github.event.pull_request.number }}" ]]; then
echo "This workflow is not associated with a pull request; exiting"
exit 1
fi

- name: Skip build from automated commit
id: check-commit
run: |
COMMIT_MESSAGE=$(git log --format=oneline -n 1 ${{ github.sha }})
echo "Build started due to commit with message $COMMIT_MESSAGE, blocking builds started by ${IGNORE_COMMIT_MESSAGE}"
if [[ $COMMIT_MESSAGE == *"${IGNORE_COMMIT_MESSAGE}"* ]]; then
echo "Skipping build due to automated commit"
exit 0
fi

- name: Set git user
run: |
git config --global user.email "dev@codecademy.com"
git config --global user.name "codecademydev"
git config --global push.default current

- name: Build All Packages
run: yarn build

- name: Build Storybook
run: yarn nx run styleguide:build-storybook

- name: Configure Netlify CLI
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
# Configure Netlify CLI to work with the styleguide project
cd packages/styleguide
npx netlify-cli@22.0.0 link --id ${{ secrets.NETLIFY_SITE_ID }}

- name: Deploy to Netlify
id: deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
DEPLOY_MESSAGE="User: ${{ github.actor }} Project: ${{ github.repository }} Pull Request: ${{ github.event.pull_request.html_url }}"
# Deploy using filter approach
if npx netlify-cli@22.0.0 deploy --message "${DEPLOY_MESSAGE}" --dir dist/storybook/styleguide --filter @codecademy/styleguide --json > .deploy-output 2>&1; then
DEPLOY_OUTPUT=$(cat .deploy-output)
# Escape the output for GitHub Actions
DEPLOY_OUTPUT_ESCAPED=$(echo "$DEPLOY_OUTPUT" | sed 's/"/\\"/g' | tr '\n' ' ')
echo "deploy-output<<EOF" >> $GITHUB_OUTPUT
echo "$DEPLOY_OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "Deploy failed. Output:"
cat .deploy-output
exit 1
fi

- name: Extract deployment URLs
id: extract-urls
if: steps.deploy.outputs.deploy-output
run: |
export DEPLOY_OUTPUT="${{ steps.deploy.outputs.deploy-output }}"
echo "Raw deploy output: $DEPLOY_OUTPUT"

# Extract URLs using a more robust method that handles malformed JSON
DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep -o 'deploy_url: [^,]*' | sed 's/deploy_url: //')
LOGS_URL=$(echo "$DEPLOY_OUTPUT" | grep -o 'logs: [^,]*' | sed 's/logs: //')

echo "Deploy URL: $DEPLOY_URL"
echo "Logs URL: $LOGS_URL"

# Set outputs for the comment step
echo "deploy-url=$DEPLOY_URL" >> $GITHUB_OUTPUT
echo "logs-url=$LOGS_URL" >> $GITHUB_OUTPUT

- name: Comment with deployment preview
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db
if: steps.extract-urls.outputs.deploy-url
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: Styleguide Deploy Preview
recreate: true
message: |
🚀 Styleguide deploy preview ready!

**Preview URL:** [${{ steps.extract-urls.outputs.deploy-url }}](${{ steps.extract-urls.outputs.deploy-url }})
**Deploy Logs:** [${{ steps.extract-urls.outputs.logs-url }}](${{ steps.extract-urls.outputs.logs-url }})
77 changes: 77 additions & 0 deletions .github/workflows/publish-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish Alpha

on:
pull_request:
branches-ignore:
- main

env:
NODE_VERSION: '22.13.1'
NODE_OPTIONS: '--max_old_space_size=8196'
NX_CLOUD: false
IGNORE_COMMIT_MESSAGE: 'chore(release): publish'

permissions:
id-token: write
contents: read
pull-requests: write
issues: write
actions: write

jobs:
publish-alpha:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup and Build
id: setup
uses: ./.github/actions/yarn

- name: Set git user
run: |
git config --global user.email "dev@codecademy.com"
git config --global user.name "codecademydev"
git config --global push.default current

- name: Set npm token
run: |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- run: npx nx run-many --target=publish-build --parallel=3

- name: Publish alpha packages
run: |
SHORT_SHA=${GITHUB_SHA:0:6}
yarn lerna publish --no-verify-access --exact --yes --include-merged-tags --no-push --no-git-reset --conventional-commits --conventional-prerelease --preid=alpha.${SHORT_SHA} --dist-tag=alpha.${SHORT_SHA}
env:
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- name: List alpha packages versions
id: published
continue-on-error: true
run: |
{
echo 'result<<EOF'
yarn lerna ll --parseable | grep -Po '@codecademy.*alpha.*' | sed 's/:/@/g' || true
echo 'EOF'
} >> $GITHUB_OUTPUT

- name: Comment with published alpha packages
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
if: steps.published.outputs.result
with:
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
header: Alpha Packages
recreate: true
message: |
📬 Published Alpha Packages:
```
${{ steps.published.outputs.result }}
```
8 changes: 8 additions & 0 deletions packages/gamut-icons/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
"cwd": "{projectRoot}",
"command": "rm -rf ./dist"
}
},
"publish-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": [],
"parallel": false
}
}
}
}
8 changes: 8 additions & 0 deletions packages/gamut-illustrations/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
"cwd": "{projectRoot}",
"command": "rm -rf ./dist"
}
},
"publish-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": [],
"parallel": false
}
}
}
}
8 changes: 8 additions & 0 deletions packages/gamut-patterns/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
"cwd": "{projectRoot}",
"command": "rm -rf ./dist"
}
},
"publish-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": [],
"parallel": false
}
}
}
}
8 changes: 8 additions & 0 deletions packages/gamut-styles/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
"cwd": "{projectRoot}",
"command": "rm -rf ./dist"
}
},
"publish-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": [],
"parallel": false
}
}
}
}
Loading
Loading