Skip to content
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

migration of release.yaml github action #67

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
111 changes: 92 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,27 @@ version: 2.1
orbs:
nx: nrwl/[email protected]
node: circleci/[email protected]
utils: ethereum-optimism/[email protected]


commands:
prepare-snapshot:
description: "Prepare the snapshot name"
steps:
- run:
name: Setup snapshot name
command: |
SNAPSHOT_NAME=${CIRCLE_BRANCH}
echo "Will create snapshot using name $SNAPSHOT_NAME"
echo "export SNAPSHOT_NAME=${SNAPSHOT_NAME}" >> "$BASH_ENV"
- run:
name: Prepare changeset version environment
command: |
echo "export GITHUB_TOKEN=${GITHUB_TOKEN_GOVERNANCE}" >> "$BASH_ENV"
- run:
name: Create snapshot versions
command: pnpm release:version:snapshot

setup:
description: "Setup"
steps:
Expand All @@ -13,14 +32,65 @@ commands:
version: '9'
- run:
name: Install pnpm dependencies
command: pnpm install
command: pnpm install --frozen-lockfile
- nx/set-shas
- run:
name: Build
command: pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=build

jobs:
lint:
publish-to-npm:
docker:
- image: cimg/node:20.11
parameters:
prepare-snapshot:
type: boolean
default: false
steps:
- checkout
- run:
name: Setup
command: |
pnpm install --frozen-lockfile
environment:
NPM_TOKEN: nada

- run:
name: Check NPM Token
command: |
if [ -z "${NPM_TOKEN}" ]; then
echo "NPM_TOKEN is not set. Please set it in CircleCI project settings."
exit 1
fi

- run:
name: Configure NPM Token and Registry
command: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"

- run:
name: Verify NPM Token
command: npm whoami

- run:
name: Build
command: pnpm nx run-many --target=build
environment:
NPM_TOKEN: nada

- when:
condition:
equal: [<< parameters.prepare-snapshot >>, true]
steps:
- prepare-snapshot

- utils/changesets:
createGithubReleases: false
publish: "pnpm release:publish"
version: "pnpm release:version"


check:
executor:
name: node/default
tag: '22.10'
Expand All @@ -29,29 +99,32 @@ jobs:
- run:
name: Lint
command: pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint
test:
executor:
name: node/default
tag: '22.10'
steps:
- setup
- run:
name: Unit Tests
command: pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=test

typecheck:
executor:
name: node/default
tag: '22.10'
steps:
- setup
- run:
name: Typecheck
command: pnpm nx affected --base=$NX_BASE --head=$NX_HEAD --target=typecheck

workflows:
main:
check-workflow:
jobs:
- lint
- test
- typecheck
- check
release:
jobs:
- publish-to-npm:
name: Publish new versions
context:
- circleci-repo-super-cli # for GITHUB_TOKEN_GOVERNANCE && NPM_TOKEN
filters:
branches:
only: main

- publish-to-npm:
name: Publish snapshot versions
prepare-snapshot: true
context:
- circleci-repo-super-cli # for GITHUB_TOKEN_GOVERNANCE && NPM_TOKEN
filters:
branches:
only: main
15 changes: 0 additions & 15 deletions .github/actions/setup/action.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/release-snapshot.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packageManager": "[email protected]",
"nx": {},
"scripts": {
"release:publish": "pnpm install --frozen-lockfile && pnpm nx run-many --target=build && changeset publish",
"release:publish": "changeset publish",
"release:version": "changeset version && pnpm install --lockfile-only"
},
"dependencies": {
Expand Down