Skip to content

sketch out GHA #3100

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

Draft
wants to merge 79 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 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
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
65 changes: 65 additions & 0 deletions .github/workflows/deploy-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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 and Build
id: setup
uses: ./.github/actions/yarn

- name: Set git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "codecademydev"
git config --global push.default current

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

- name: Deploy to Netlify
id: deploy
run: |
DEPLOY_MESSAGE="User: ${{ github.actor }} Project: ${{ github.repository }} Pull Request: ${{ github.event.pull_request.html_url }}"
echo "deploy-output=$(npx [email protected] deploy --message "${DEPLOY_MESSAGE}" --dir dist/storybook/styleguide --json --filter @codecademy/styleguide)" >> $GITHUB_OUTPUT
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# when this is added, can't find project id -_- without it we run into main() error!!!

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

**Deploy URL:** ${{ fromJson(steps.deploy.outputs.deploy-output).deploy_url }}
**Deploy Logs:** ${{ fromJson(steps.deploy.outputs.deploy-output).logs }}

<!--ALPHA_DEPLOY_COMMENT-->
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 "[email protected]"
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
}
}
}
}
8 changes: 8 additions & 0 deletions packages/gamut-tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
"cwd": "{projectRoot}",
"command": "rm -rf ./dist"
}
},
"publish-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": [],
"parallel": false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const PopoverExample = ({ p = 16, ...rest }: PopoverExampleProps) => {
</Box>
<FlexBox>
<Popover
{...(rest as any)}
{...rest}
isOpen={open}
targetRef={activeElRef}
onRequestClose={() => setOpen(false)}
Expand Down
8 changes: 8 additions & 0 deletions packages/variance/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
}
}
}
}
Loading