Skip to content

Commit 85439fd

Browse files
ci(sdk): init release-please (#461)
* ci(sdk): init release-please * ci(sdk): automate publish on npm when a release is published
1 parent 62da0dc commit 85439fd

File tree

5 files changed

+87
-22
lines changed

5 files changed

+87
-22
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: npm publish latest - dataprotector
2+
description: Publish on npm when a release is published
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
publish-npm:
10+
# check tag is "sdk-v*"
11+
if: contains(github.ref_name,'sdk-v')
12+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
13+
with:
14+
scope: '@iexec/dataprotector-sdk'
15+
registry: 'https://registry.npmjs.org'
16+
node-version: '18'
17+
working-directory: packages/sdk
18+
tag: 'latest'
19+
install-command: |
20+
npm ci
21+
npm run codegen
22+
secrets:
23+
npm-token: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish-npm-sdk.yml renamed to .github/workflows/publish-npm-sdk-staging.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
name: Publish Package NPM - dataprotector
1+
name: npm publish staging - dataprotector
2+
description: Publish a staging version on npm
23

34
on:
45
workflow_dispatch:
5-
inputs:
6-
tag:
7-
description: 'NPM tag to publish (latest or nightly)'
8-
required: true
9-
type: choice
10-
options:
11-
- latest
12-
- nightly
13-
- beta
14-
default: nightly
156

167
jobs:
178
set-publish-version:
@@ -25,31 +16,26 @@ jobs:
2516
uses: actions/setup-node@v4
2617
- name: Set publish version
2718
id: set-publish-version
28-
if: github.event.inputs.tag == 'nightly'
2919
working-directory: packages/sdk
3020
run: |
31-
if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
32-
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
33-
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
34-
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
35-
else
36-
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
37-
fi
21+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
22+
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
23+
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
3824
outputs:
3925
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
4026

4127
publish-npm:
4228
# Run only on main branch
4329
if: github.ref == 'refs/heads/main'
44-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.4.0
30+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0
4531
needs: set-publish-version
4632
with:
4733
scope: '@iexec/dataprotector-sdk'
4834
registry: 'https://registry.npmjs.org'
4935
node-version: '18'
50-
environment: ${{ github.event.inputs.target }}
36+
environment: 'staging'
5137
working-directory: packages/sdk
52-
tag: ${{ github.event.inputs.tag }}
38+
tag: 'nightly'
5339
version: ${{ needs.set-publish-version.outputs.VERSION }}
5440
install-command: |
5541
npm ci
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: release-please
2+
description: triggers release-please to open the next release PR
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
14+
jobs:
15+
release-please:
16+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
17+
secrets: inherit

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"packages/sdk": "2.0.0-beta.16"
3+
}

release-please-config.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"include-component-in-tag": false,
4+
"changelog-sections": [
5+
{ "type": "feat", "section": "Added", "hidden": false },
6+
7+
{ "type": "fix", "section": "Changed", "hidden": false },
8+
{ "type": "change", "section": "Changed", "hidden": false },
9+
{ "type": "deprecate", "section": "Changed", "hidden": false },
10+
{ "type": "revert", "section": "Changed", "hidden": false },
11+
{ "type": "security", "section": "Changed", "hidden": false },
12+
{ "type": "perf", "section": "Changed", "hidden": false },
13+
{ "type": "refactor", "section": "Changed", "hidden": false },
14+
15+
{ "type": "remove", "section": "Removed", "hidden": false },
16+
17+
{ "type": "style", "section": "Misc", "hidden": true },
18+
{ "type": "build", "section": "Misc", "hidden": true },
19+
{ "type": "chore", "section": "Misc", "hidden": true },
20+
{ "type": "test", "section": "Misc", "hidden": true },
21+
{ "type": "deps", "section": "Misc", "hidden": true },
22+
{ "type": "ci", "section": "Misc", "hidden": true },
23+
{ "type": "docs", "section": "Misc", "hidden": true }
24+
],
25+
"packages": {
26+
"packages/sdk": {
27+
"release-type": "node",
28+
"changelog-path": "CHANGELOG.md",
29+
"include-v-in-tag": true,
30+
31+
"prerelease": true,
32+
"prerelease-type": "beta",
33+
"versioning": "prerelease"
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)