-
Notifications
You must be signed in to change notification settings - Fork 1
Add release #43
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
Merged
Merged
Add release #43
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a447d26
remove private from manifest
andrew-fleming c33b28c
add release yml
andrew-fleming 23e2608
add releasing doc
andrew-fleming e9cb3fe
fix grammar
andrew-fleming 9bf679a
Refactor setup action
emnul 72a458c
Add harden-runner action, pin version, skip compact, restrict permiss…
emnul f166a4f
Restrict permission to specific job, improve readability
emnul 4f69c3d
remove skip-compact
emnul cd24f7e
improve error handling in simulator setup
emnul 5726cc7
lint file
emnul 71c55fa
add space
andrew-fleming 60abf7f
remove space
andrew-fleming 3c1a441
add space
andrew-fleming ab2fe56
remove space
andrew-fleming 33ad86f
Restrict permissions
emnul 634a577
Merge branch 'main' into add-release
emnul 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: Release Package | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| package: | ||
| description: "Which package to release" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - compact-tools-cli | ||
| - compact-tools-simulator | ||
| version_bump: | ||
| description: "Version bump type" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release ${{ inputs.package }} | ||
| runs-on: ubuntu-24.04 | ||
| environment: compact-npm-prod # Requires approval | ||
|
|
||
| permissions: | ||
| contents: write # Required to push commits and tags | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set package directory | ||
| id: pkg | ||
| run: | | ||
| case "${{ inputs.package }}" in | ||
| "compact-tools-cli") | ||
| echo "dir=cli" >> $GITHUB_OUTPUT | ||
| ;; | ||
| "compact-tools-simulator") | ||
| echo "dir=simulator" >> $GITHUB_OUTPUT | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Setup Environment | ||
| uses: ./.github/actions/setup | ||
|
|
||
| - name: Run tests for package | ||
| run: yarn test --filter=@openzeppelin/${{ inputs.package }} | ||
|
|
||
| - name: Build package | ||
| run: yarn build --filter=@openzeppelin/${{ inputs.package }} | ||
|
|
||
| - name: Bump version | ||
| id: version | ||
| run: | | ||
| cd packages/${{ steps.pkg.outputs.dir }} | ||
| yarn version ${{ inputs.version_bump }} | ||
| NEW_VERSION=$(node -p "require('./package.json').version") | ||
| echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "### Release Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Package: ${{ inputs.package }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- New version: $NEW_VERSION" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Bump type: ${{ inputs.version_bump }}" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| - name: Verify package contents | ||
| run: | | ||
| cd packages/${{ steps.pkg.outputs.dir }} | ||
| yarn pack --dry-run | ||
|
|
||
| - name: Commit and tag version bump | ||
| uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0 | ||
| with: | ||
| commit_message: "chore: release ${{ inputs.package }} v${{ steps.version.outputs.new }}" | ||
| file_pattern: "packages/${{ steps.pkg.outputs.dir }}/package.json" | ||
| tagging_message: "${{ inputs.package }}/v${{ steps.version.outputs.new }}" | ||
|
|
||
| - name: Publish to npm | ||
| run: | | ||
| yarn config set npmAuthToken "$NPM_TOKEN" | ||
| cd packages/${{ steps.pkg.outputs.dir }} | ||
| yarn npm publish --access public --provenance | ||
| env: | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,17 @@ | ||
| # Releasing | ||
|
|
||
| 1. Go to "Release Package" in Actions. | ||
| 2. Click on the "Run workflow" dropdown menu. | ||
| 3. Choose the package to release and the version bump type. | ||
| Following [SemVer](https://semver.org/): | ||
| - **Patch** - Backward-compatible bug fixes. | ||
| - **Minor** - New functionality in a backward compatible way. | ||
| - **Major** - Breaking API changes. | ||
|
|
||
| 4. A maintainer must approve the release before it proceeds. | ||
| 5. Once approved, the CI will automatically: | ||
| - Run tests. | ||
| - Bump the version. | ||
| - Create a git tag. | ||
| - Publish the package to npm. | ||
| 6. Once published, go to "Releases" and create a GitHub release using the generated tag. |
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 |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| { | ||
| "name": "@openzeppelin/compact-tools-simulator", | ||
| "private": true, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here, but more specifically for those packages I think its better to remove the -tools- word from the name to be |
||
| "description": "Simulator for testing Compact smart contracts", | ||
| "version": "0.0.1", | ||
| "keywords": [ | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should still remove this. Because I think the name of the package will be a bit misleading, I was thinking to to leave this private and if we are we follow the proposal I had regarding
copmact-tools, wdyt?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss this in a separate PR / Issue to avoid blocking it.