Skip to content

Commit ccc1ce0

Browse files
committed
very sketchy
1 parent 6eb8613 commit ccc1ce0

File tree

13 files changed

+165
-9
lines changed

13 files changed

+165
-9
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ references:
66
default_env: &default_env
77
docker:
88
- image: cimg/node:22.13.1
9-
working_directory: ~/repo
9+
working_directory: ~/repo # not required?
1010
environment:
1111
IGNORE_COMMIT_MESSAGE: 'chore(release): publish'
1212
NODE_OPTIONS: '--max_old_space_size=8196'
@@ -67,7 +67,7 @@ references:
6767
- packages
6868

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

7373
build_all_packages: &build_all_packages
@@ -111,7 +111,7 @@ jobs:
111111
checkout_code:
112112
<<: *default_env
113113
steps:
114-
- checkout
114+
- checkout # circle keyword
115115
- *set_npm_token
116116
- *restore_yarn_cache
117117
- run: yarn --production=false --frozen-lockfile

.github/actions/nx-cache/action.yml

Whitespace-only changes.

.github/actions/webpack-cache/action.yml

Whitespace-only changes.

.github/actions/yarn/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Restore Yarn Cache'
2+
description: 'Setup a NodeJS environment and restore cache if any, given a node version'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
9+
with:
10+
node-version-file: .nvmrc
11+
12+
- name: Install Dependencies If Not Cached
13+
run: \[ -d node_modules \] || yarn install --immutable
14+
shell: bash
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const affectedMatrix = require('../../../libs/nx/affected-matrix/src/index.js');
2+
3+
module.exports = async ({ core }) => {
4+
return await affectedMatrix({ core });
5+
};
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish Alpha
2+
3+
on:
4+
pull_request:
5+
branches-ignore:
6+
- production
7+
8+
permissions:
9+
id-token: write
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
actions: write
14+
15+
jobs:
16+
check-affected:
17+
uses: ./.github/workflows/check-affected.yml
18+
with:
19+
target: publish-build
20+
21+
publish: # do we want to add nx-affected to Gamut?
22+
runs-on: ubuntu-22.04
23+
needs: check-affected
24+
if: needs.check-affected.outputs.affected == 'true'
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
fetch-depth: 0
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
31+
- name: Set git user
32+
run: |
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "codecademydev"
35+
git config --global push.default current
36+
37+
- name: Set npm token
38+
run: |
39+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
40+
env:
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
43+
- name: Set Short SHA and PR Number
44+
id: sha
45+
run: |
46+
echo "PR_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
47+
echo "PR_NUM=${{ github.event.number }}" >> $GITHUB_ENV
48+
49+
- uses: ./.github/actions/yarn
50+
# The context provided here has the current active EKS cluster name (such as `-blue`) appended in the action.yaml
51+
# - uses: ./.github/actions/k8s-setup
52+
# with:
53+
# context: development
54+
- uses: ./.github/actions/nx-setup
55+
56+
- run: npx nx run-many --target=publish-build --parallel=3
57+
58+
- name: Check version plan
59+
run: |
60+
if ! npx nx release plan:check; then
61+
echo "Run \`yarn nx release plan\` to generate a version plan."
62+
exit 1
63+
fi
64+
65+
- name: Publish alpha packages
66+
env:
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
run: npx nx run pkg-publish:publish-affected:alpha
69+
70+
- name: List alpha packages versions
71+
id: published
72+
continue-on-error: true
73+
run: |
74+
shopt -s globstar
75+
echo 'result<<EOF' >> $GITHUB_OUTPUT
76+
jq -r 'select(.version | contains("alpha")) | .name + "@" + .version' libs/**/package.json >> $GITHUB_OUTPUT
77+
echo 'EOF' >> $GITHUB_OUTPUT
78+
79+
- name: Comment with published alpha packages
80+
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
81+
if: steps.published.outputs.result
82+
with:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
header: Alpha Packages
85+
recreate: true
86+
message: |
87+
```
88+
${{ steps.published.outputs.result }}
89+
```

packages/gamut-icons/project.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
"cwd": "{projectRoot}",
4242
"command": "rm -rf ./dist"
4343
}
44-
}
44+
},
45+
"publish-build": {
46+
"executor": "nx:run-commands",
47+
"dependsOn": ["build"],
48+
"options": {
49+
"commands": [],
50+
"parallel": false
51+
}
4552
}
4653
}
54+
}

packages/gamut-illustrations/project.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
"cwd": "{projectRoot}",
3232
"command": "rm -rf ./dist"
3333
}
34-
}
34+
},
35+
"publish-build": {
36+
"executor": "nx:run-commands",
37+
"dependsOn": ["build"],
38+
"options": {
39+
"commands": [],
40+
"parallel": false
41+
}
3542
}
3643
}
44+
}

packages/gamut-patterns/project.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
"cwd": "{projectRoot}",
4141
"command": "rm -rf ./dist"
4242
}
43-
}
43+
},
44+
"publish-build": {
45+
"executor": "nx:run-commands",
46+
"dependsOn": ["build"],
47+
"options": {
48+
"commands": [],
49+
"parallel": false
50+
}
4451
}
4552
}
53+
}

packages/gamut-styles/project.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
"cwd": "{projectRoot}",
3535
"command": "rm -rf ./dist"
3636
}
37-
}
37+
},
38+
"publish-build": {
39+
"executor": "nx:run-commands",
40+
"dependsOn": ["build"],
41+
"options": {
42+
"commands": [],
43+
"parallel": false
44+
}
3845
}
3946
}
47+
}

0 commit comments

Comments
 (0)