-
Notifications
You must be signed in to change notification settings - Fork 14
fix(gh-actions): release PR requisted changes #284
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
Open
0xisk
wants to merge
46
commits into
main
Choose a base branch
from
fix/release-issues
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
92b46a8
add wrapAsEither circuits
andrew-fleming 9fc5bbe
add option to compile directory in compact
andrew-fleming 98b7a32
add granular compile scripts
andrew-fleming ae9e311
fix fmt
andrew-fleming 4a9885b
use fast compilation prior to tests, cache tests
andrew-fleming d707d28
revert changes
andrew-fleming d113802
update readme with targeted compilation
andrew-fleming c004dd8
build preserves dir structure
andrew-fleming 6de7a17
keep compact files in directories in dist, add tsc in build
andrew-fleming 787f91b
include explicit witnesses in tsconfig, remove sourceMap
andrew-fleming 865aa11
move compact compiler install to composite action
andrew-fleming 579ef4d
add prepare-release workflow (version bump)
andrew-fleming 7f64555
add release workflow
andrew-fleming f2067a8
add releasing doc
andrew-fleming f6c7c5c
remove comment
andrew-fleming d46ffaf
remove unused env, remove redundant compile in favor of build
andrew-fleming f71f616
add provenance
andrew-fleming 9f9be1e
remove private field from contracts
andrew-fleming 60b5b3a
add manifest metadata, remove private field
andrew-fleming 67c95ff
fix fmt
andrew-fleming 9982d95
improve find pattern
andrew-fleming 5cb6300
further improve find pattern
andrew-fleming 810e5d0
Merge branch 'main' into support-releasing
andrew-fleming fd96741
fix conflicts
andrew-fleming 90f8762
Apply suggestions from code review
andrew-fleming e5e650f
Standardize zero address structure
emnul ae88fea
fix: compcat install url variable
0xisk 88728ba
fix: trusted publisher, and node check
0xisk a5f27b9
fix: conflicts with main
0xisk e2b244c
fix: requested changes from code rabbit
0xisk 2233d58
fix: ci issues
0xisk e06d048
fix: ci issues
0xisk 0028e18
Updates codeql-action to latest version
emnul 83b8129
Updates setup-node to v6
emnul 006522e
Update compact version and setup-node action version
emnul 8c5674c
Merge branch 'main' into fix/release-issues
emnul a279b5a
Updates Compact version in various file docs, tooling, etc
emnul 35dfd69
Use pinned OS version
emnul 98a2dba
Use latest setup-node version
emnul 11755b8
Use pinned OS runner version
emnul 42b2b9e
biome lint fix
emnul d11542f
Ensure default compiler version is set
emnul ec0845b
Merge branch 'main' into fix/release-issues
emnul fc8ffb1
Merge branch 'main' into fix/release-issues
emnul 9072d97
fix: .github/workflows/prepare-release.yml
0xisk 3bab84a
fix: .github/workflows/prepare-release.yml
0xisk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,83 @@ | ||
| name: Update version on new release branch | ||
|
|
||
| on: | ||
| create: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| update_version: | ||
| if: github.ref_type == 'branch' && startsWith(github.ref, 'refs/heads/release-v') | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: "yarn" | ||
|
|
||
| - name: Extract current version | ||
| run: | | ||
| CURRENT_VERSION=$(node -p "require('./contracts/package.json').version") | ||
| echo "CURRENT_VERSION=$CURRENT_VERSION" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Extract new version number | ||
| run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Validate new version | ||
| run: | | ||
| BRANCH="${GITHUB_REF#refs/heads/}" | ||
| echo "Branch: $BRANCH" | ||
| echo "Current version: $CURRENT_VERSION" | ||
| echo "New version: $NEW_VERSION" | ||
|
|
||
| # 1) Branch must match release-v<semver> | ||
| if ! echo "$BRANCH" | grep -Eq '^release-v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then | ||
| echo "Error: Branch '$BRANCH' must match 'release-v<semver>' (e.g., release-v1.2.3)." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 2) NEW_VERSION must be valid semver | ||
| node -e "const v=process.env.NEW_VERSION; const semver=/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$/; if(!semver.test(v)){ console.error('Error: NEW_VERSION is not valid semver:', v); process.exit(1); }" | ||
| if [ $? -ne 0 ]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 3) NEW_VERSION must differ from CURRENT_VERSION | ||
| if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| echo "Error: NEW_VERSION equals CURRENT_VERSION ($CURRENT_VERSION). Nothing to release." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Replace version in files | ||
| env: | ||
| NEW_VERSION: ${{ env.NEW_VERSION }} | ||
| run: | | ||
| echo "Current version: $CURRENT_VERSION" | ||
| echo "New version: $NEW_VERSION" | ||
|
|
||
| # Update package.json version field manually | ||
| yarn workspace @openzeppelin-compact/contracts version "$NEW_VERSION" | ||
|
|
||
| # Escape special characters for sed | ||
| ESCAPED_CURRENT=$(printf '%s' "$CURRENT_VERSION" | sed -e 's/[\/&]/\\&/g') | ||
| ESCAPED_NEW=$(printf '%s' "$NEW_VERSION" | sed -e 's/[\/&]/\\&/g') | ||
|
|
||
| # Replace version in contracts/src/ | ||
| find ./contracts/src/ -type d -name '.*' -prune -o \ | ||
| -type f -exec sed -i "s#$ESCAPED_CURRENT#$ESCAPED_NEW#g" {} + | ||
|
|
||
| # Replace version in docs/, excluding package-lock.json | ||
| find ./docs/ -type d -name '.*' -prune -o \ | ||
| -type f ! -name 'package-lock.json' -exec sed -i "s#$ESCAPED_CURRENT#$ESCAPED_NEW#g" {} + | ||
|
|
||
| - name: Auto-commit changes | ||
| uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 #v6.0.1 | ||
| with: | ||
| commit_message: Bump version to ${{ env.NEW_VERSION }} | ||
This file contains hidden or 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,93 @@ | ||
| name: Publish Package on Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| env: | ||
| COMPACT_INSTALLER_URL: ${{ vars.COMPACT_INSTALLER_URL }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Environment | ||
| uses: ./.github/actions/setup | ||
|
|
||
| - name: Build contracts | ||
| run: turbo build --filter=!'docs' | ||
|
|
||
| - name: Validate version consistency | ||
| run: | | ||
| RELEASE_VERSION=${GITHUB_REF#refs/tags/v} | ||
| PACKAGE_VERSION=$(node -p "require('./contracts/package.json').version") | ||
| if [ "$RELEASE_VERSION" != "$PACKAGE_VERSION" ]; then | ||
| echo "❌ Version mismatch: Release $RELEASE_VERSION vs Package $PACKAGE_VERSION" | ||
| exit 1 | ||
| fi | ||
| echo "✅ Version consistency validated: $RELEASE_VERSION" | ||
|
|
||
| - name: Setup npm registry | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - name: Pack tarball | ||
| id: pack | ||
| run: | | ||
| cd contracts/dist | ||
| TARBALL=$(npm pack | tail -1) | ||
| echo "tarball_name=$TARBALL" >> $GITHUB_OUTPUT | ||
| echo "tarball=$(pwd)/$TARBALL" >> $GITHUB_OUTPUT | ||
|
|
||
| # Determine dist-tag based on semver prerelease | ||
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
| if [[ "$PACKAGE_VERSION" =~ -.*$ ]]; then | ||
| # Has prerelease suffix (anything after -) | ||
| if [[ "$PACKAGE_VERSION" =~ -(alpha|beta|rc) ]]; then | ||
| echo "tag=beta" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "tag=next" >> $GITHUB_OUTPUT | ||
| fi | ||
| else | ||
| # Stable release | ||
| echo "tag=latest" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Verify tarball integrity | ||
| run: | | ||
| echo "=== Verifying tarball contents ===" | ||
| PACKAGE_NAME=$(tar xfO "${{ steps.pack.outputs.tarball }}" package/package.json | jq -r .name) | ||
| PACKAGE_VERSION=$(tar xfO "${{ steps.pack.outputs.tarball }}" package/package.json | jq -r .version) | ||
| PRIVATE_FIELD=$(tar xfO "${{ steps.pack.outputs.tarball }}" package/package.json | jq -r '.private // "not found"') | ||
|
|
||
| echo "📦 Package: $PACKAGE_NAME@$PACKAGE_VERSION" | ||
| echo "🏷️ Tag: ${{ steps.pack.outputs.tag }}" | ||
| echo "🔒 Private field: $PRIVATE_FIELD" | ||
|
|
||
| # Ensure no private field | ||
| if [ "$PRIVATE_FIELD" = "true" ]; then | ||
| echo "❌ Tarball contains private: true - cannot publish" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Publish to npm | ||
| run: | | ||
| # Publish the tarball with appropriate tag | ||
| npm publish "${{ steps.pack.outputs.tarball }}" --tag "${{ steps.pack.outputs.tag }}" --access public --provenance | ||
| env: | ||
| NPM_CONFIG_PROVENANCE: true | ||
|
|
||
| - name: Log success | ||
| run: | | ||
| PACKAGE_NAME=$(tar xfO "${{ steps.pack.outputs.tarball }}" package/package.json | jq -r .name) | ||
| PACKAGE_VERSION=$(tar xfO "${{ steps.pack.outputs.tarball }}" package/package.json | jq -r .version) | ||
| echo "✅ Successfully published $PACKAGE_NAME@$PACKAGE_VERSION to npm with tag ${{ steps.pack.outputs.tag }}" | ||
| echo "📦 Install with: npm install $PACKAGE_NAME@${{ steps.pack.outputs.tag }}" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.