Skip to content

Commit 950ec4e

Browse files
authored
ci: Fix NPM publish workflow (#297)
1 parent 50b772f commit 950ec4e

File tree

7 files changed

+60
-18
lines changed

7 files changed

+60
-18
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Code owners are automatically requested to review when a pull request
2+
# is opened (ready for review).
3+
# See https://search.brave.com/search?q=About+code+owners+-+GitHub+Docs
4+
5+
# A Ruleset is created in this GitHub repository to automatically request
6+
# Copilot's review when pull requests are created as drafts or when they
7+
# are ready for review.
8+
# See https://github.com/iExecBlockchainComputing/PoCo/settings/rules/9055086
9+
10+
* @zguesmi @gfournieriExec @Le-Caignec

.github/workflows/deploy.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ on:
1515
default: 'hardhat'
1616

1717
jobs:
18-
# Build and test before deploying.
19-
build-and-test:
18+
pre-deploy:
2019
uses: ./.github/workflows/main.yml
2120

2221
deploy:
23-
needs: build-and-test
22+
needs: pre-deploy
2423
runs-on: ubuntu-latest
2524
environment: ${{ inputs.network }} # Use the selected environment
2625
permissions:

.github/workflows/publish.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
# ⚠️ THIS WORKFLOW IS THE TRUSTED PUBLISHER CONFIGURED ON NPMJS.COM, DO NOT RENAME OR DELETE THIS FILE ⚠️
2+
23
name: Publish NPM Package
34

45
on:
56
push:
67
tags:
78
- 'v*'
89

9-
permissions:
10-
id-token: write # Required for OIDC
11-
packages: write
12-
contents: read
13-
1410
jobs:
15-
build-and-test:
11+
pre-publish:
1612
uses: ./.github/workflows/main.yml
1713

14+
determine-dist-tag:
15+
needs: pre-publish
16+
runs-on: ubuntu-latest
17+
outputs:
18+
TAG: ${{ steps.set-dist-tag.outputs.TAG }}
19+
steps:
20+
- name: Determine package dist tag
21+
id: set-dist-tag
22+
run: |
23+
if [[ "${GITHUB_REF#refs/tags/}" == *"-rc"* ]]; then
24+
echo "TAG=rc" >> $GITHUB_OUTPUT
25+
else
26+
echo "TAG=latest" >> $GITHUB_OUTPUT
27+
fi
28+
1829
publish:
19-
needs: build-and-test
30+
needs: determine-dist-tag
31+
permissions:
32+
id-token: write # Required for OIDC
33+
packages: write
34+
contents: read
2035
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
36+
with:
37+
tag: ${{ needs.determine-dist-tag.outputs.TAG }}

.github/workflows/upgrade-facets.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ on:
2121
default: true
2222

2323
jobs:
24-
# Build and test before upgrading.
25-
build-and-test:
24+
pre-upgrade:
2625
uses: ./.github/workflows/main.yml
2726

2827
upgrade:
29-
needs: build-and-test
28+
needs: pre-upgrade
3029
runs-on: ubuntu-latest
3130
environment: ${{ inputs.network }} # Use the selected environment
3231
permissions:

docs/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ npm run verify:all -- --network <your network name> # e.g. arbitrum
150150
This script automatically reads all deployed contract addresses and their constructor arguments from the deployment artifacts and verifies them on the relevant block explorer.
151151
152152
153-
### Formatting
153+
### Format
154154
155155
Format a specific file or files in a directory:
156156
```
@@ -189,3 +189,19 @@ To render only storage diagrams:
189189
```
190190
npm run storage-to-diagrams
191191
```
192+
193+
### Release
194+
195+
- **Final releases** are automated using [Release Please](https://github.com/googleapis/release-please). Major, minor, and patch versions should be published through the corresponding GitHub Actions workflows.
196+
- **Prereleases** (`vX.Y.Z-rc.*`) should be created manually using:
197+
```
198+
npm run prerelease
199+
```
200+
This command will:
201+
- Bump the RC version in `package.json` and `package-lock.json` files.
202+
- Create a new commit with the version bump.
203+
- Generate the corresponding Git tag.
204+
205+
Running this command ensures that the version in package.json matches the Git tag. This alignment is required for correct package publication and to automatically determine the appropriate npm dist tag (see [publish.yml](../.github/workflows/publish.yml)).
206+
207+
> Note: There is no need to create a full GitHub release for prerelease versions, a Git tag is sufficient.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@iexec/poco",
3-
"version": "6.1.0-contracts",
3+
"version": "6.1.0-rc.5",
44
"description": "iExec Proof of Contribution protocol smart contracts",
55
"author": "iExec",
66
"license": "Apache-2.0",
@@ -24,7 +24,8 @@
2424
"sol-to-uml": "npx zx scripts/tools/sol-to-uml.mjs",
2525
"puml-to-links": "npx zx scripts/tools/puml-to-links.mjs",
2626
"storage-to-diagrams": "bash scripts/tools/storage-to-diagrams.sh",
27-
"doc": "npx hardhat docgen"
27+
"doc": "npx hardhat docgen",
28+
"prerelease": "npm version prerelease --preid=rc -m 'chore: v%s'"
2829
},
2930
"files": [
3031
"/abis",

0 commit comments

Comments
 (0)