Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
add release workflow
  • Loading branch information
andrew-fleming committed Nov 24, 2025
commit 3e93b140b23da674d703cebc5226f5e5ec6b49ff
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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

permissions:
contents: write # Required to push commits and tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to move this to the jobs that need the permissions, perhaps not a high priority right now but it will bubble up again later as I will be trying to fix this across all of our repos.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. We're tracking this here #31

id-token: write # Required for npm provenance

env:
TURBO_TELEMETRY_DISABLED: 1

jobs:
release:
name: Release ${{ inputs.package }}
runs-on: ubuntu-24.04
# environment: compact-npm-prod # Requires approval

env:
COMPACT_INSTALLER_URL: ${{ vars.COMPACT_INSTALLER_URL }}

steps:
- name: Check out code
uses: actions/checkout@v5
with:
fetch-depth: 0

- 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/${{ inputs.package }}
yarn version ${{ inputs.version_bump }} --no-git-tag-version
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/${{ inputs.package }}
yarn pack --dry-run

- name: Commit and tag version bump
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: "Release ${{ inputs.package }} v${{ steps.version.outputs.new }}"
file_pattern: "packages/${{ inputs.package }}/package.json"
tagging_message: "${{ inputs.package }}/v${{ steps.version.outputs.new }}"

- name: Publish to npm
run: |
cd packages/${{ inputs.package }}
yarn npm publish --access public --provenance
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}