Skip to content

Commit 74e0a90

Browse files
authored
feat: Add release-please pipeline (#2)
1 parent 08e3492 commit 74e0a90

File tree

4 files changed

+195
-0
lines changed

4 files changed

+195
-0
lines changed

.github/release-please/config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"bump-minor-pre-major": true,
3+
"bump-patch-for-minor-pre-major": true,
4+
"release-type": "simple",
5+
"include-component-in-tag": false,
6+
"group-pull-request-title-pattern": "chore: release ${component} ${version}",
7+
"packages": {
8+
"./proof_verifier_js/ts": {
9+
"component": "@ethproofs-airbender-verifier",
10+
"extra-files": [
11+
{
12+
"type": "json",
13+
"path": "package.json",
14+
"jsonpath": "$.version"
15+
}
16+
]
17+
}
18+
}
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ci-run-release-please
2+
3+
# Give permissions to the release-please bot to open and update PRs
4+
# and commit to PRs the repository to update package.json
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
id-token: write
9+
attestations: write
10+
packages: write
11+
issues: write
12+
13+
# Run the workflow on push to the main branch and manually
14+
on:
15+
push:
16+
branches:
17+
- main
18+
workflow_dispatch:
19+
20+
jobs:
21+
# Prepare the release PR with changelog updates and create github releases
22+
# Do not publish to crates.io or upgrade dependencies
23+
release-please:
24+
uses: matter-labs/zksync-ci-common/.github/workflows/release-please.yaml@v1
25+
secrets:
26+
gh_token: ${{ secrets.RELEASE_TOKEN }}
27+
with:
28+
config: '.github/release-please/config.json' # Specify the path to the configuration file
29+
manifest: '.github/release-please/manifest.json' # Specify the path to the manifest file
30+
upgrade-dependencies: false # Do not upgrade workspace dependencies
31+
update-cargo-lock: false
32+
publish-to-crates-io: false
33+
notify-slack: false
34+
35+
# Trigger workflow to publish binaries
36+
release-binaries:
37+
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
38+
needs: release-please
39+
uses: ./.github/workflows/ci-release.yaml
40+
with:
41+
tag: ${{ needs.release-please.outputs.tag_name }}
42+
secrets: inherit

.github/workflows/ci-release.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: ci-release-js
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
type: string
8+
description: 'Exact git tag to release (omit to use HEAD)'
9+
required: false
10+
workflow_dispatch:
11+
inputs:
12+
tag:
13+
description: 'Git tag to release (leave blank for HEAD)'
14+
required: false
15+
type: string
16+
prerelease_name:
17+
description: 'Suffix for a manual pre-release (blank = full release)'
18+
required: false
19+
type: string
20+
default: ''
21+
skip_publish:
22+
description: 'Skip publishing to npm'
23+
required: false
24+
type: boolean
25+
default: true
26+
27+
jobs:
28+
create-release:
29+
name: Create release for TS library
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
id-token: write
34+
defaults:
35+
run:
36+
working-directory: ./proof_verifier_js/ts
37+
38+
env:
39+
COMPILE_ARTIFACTS: 'false'
40+
41+
steps:
42+
- name: Checkout sources
43+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
44+
with:
45+
fetch-depth: 0
46+
ref: ${{ inputs.tag || '' }}
47+
48+
- name: Determine tag
49+
id: tag
50+
run: |
51+
TAG_INPUT="${{ inputs.tag }}"
52+
53+
# Check if the tag input is provided
54+
if [ -n "$TAG_INPUT" ]; then
55+
# Sanitize the input - request by security team
56+
# Replace any character that is NOT
57+
# alphanumeric, a hyphen, an underscore, or a period with nothing.
58+
# This prevents unexpected shell chars (like ;, $, |, etc.)
59+
# from being executed.
60+
SANITIZED_TAG=$(echo "$TAG_INPUT" | tr -cd '[:alnum:]._-')
61+
62+
# Use the sanitized tag
63+
echo "value=$SANITIZED_TAG" >> "$GITHUB_OUTPUT"
64+
65+
if [ "$TAG_INPUT" != "$SANITIZED_TAG" ]; then
66+
echo "Warning: Input tag was sanitized from '$TAG_INPUT' to '$SANITIZED_TAG'"
67+
fi
68+
69+
else
70+
# Fallback to commit short SHA if no tag is provided
71+
echo "value=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
72+
fi
73+
74+
- name: Update release-please release artifacts
75+
if: ${{ inputs.tag != '' }}
76+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
77+
with:
78+
tag_name: ${{ inputs.tag }}
79+
80+
- name: Publish release
81+
if: ${{ inputs.prerelease_name != '' }}
82+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
83+
with:
84+
tag_name: ${{ steps.tag.outputs.value }}
85+
name: ethproofs-airbender-verifier ${{ steps.tag.outputs.value }}${{ inputs.prerelease_name && format(' {0}', inputs.prerelease_name) || '' }}
86+
target_commitish: ${{ github.sha }}
87+
prerelease: ${{ inputs.prerelease_name != '' }}
88+
89+
# Trigger package publishing to npm registry
90+
publish:
91+
name: Publish TS library to npm
92+
runs-on: ubuntu-latest
93+
if: ${{ inputs.skip_publish != 'true' }}
94+
permissions:
95+
contents: read
96+
id-token: write # Required for npm OIDC trusted publishing
97+
defaults:
98+
run:
99+
working-directory: ./proof_verifier_js/ts
100+
101+
steps:
102+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
103+
104+
- name: Install Rust toolchain
105+
uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
106+
with:
107+
inherit-toolchain: true
108+
109+
- uses: taiki-e/install-action@3522286d40783523f9c7880e33f785905b4c20d0 # v2.66.1
110+
with:
111+
tool: wasm-pack
112+
113+
114+
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
115+
with:
116+
node-version: 22.x
117+
registry-url: 'https://registry.npmjs.org'
118+
119+
- uses: mskelton/setup-yarn@8d0bc12bc7f72a9acfc32019da0381dfcb481df0 # v3.0.0
120+
121+
- name: Upgrade npm for OIDC support
122+
run: npm install -g npm@11.7.0
123+
124+
- name: Install deps
125+
run: yarn install
126+
127+
- name: Build
128+
run: yarn build
129+
130+
- name: Publish to npm
131+
run: npm publish --access public --tag latest --provenance

0 commit comments

Comments
 (0)