diff --git a/.github/workflows/publish-npm-sdk-latest.yml b/.github/workflows/publish-npm-sdk-latest.yml new file mode 100644 index 000000000..127f240f7 --- /dev/null +++ b/.github/workflows/publish-npm-sdk-latest.yml @@ -0,0 +1,23 @@ +name: npm publish latest - dataprotector +description: Publish on npm when a release is published + +on: + release: + types: [published] + +jobs: + publish-npm: + # check tag is "sdk-v*" + if: contains(github.ref_name,'sdk-v') + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0 + with: + scope: '@iexec/dataprotector-sdk' + registry: 'https://registry.npmjs.org' + node-version: '18' + working-directory: packages/sdk + tag: 'latest' + install-command: | + npm ci + npm run codegen + secrets: + npm-token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-npm-sdk.yml b/.github/workflows/publish-npm-sdk-staging.yml similarity index 54% rename from .github/workflows/publish-npm-sdk.yml rename to .github/workflows/publish-npm-sdk-staging.yml index 9ded6c032..af2928e29 100644 --- a/.github/workflows/publish-npm-sdk.yml +++ b/.github/workflows/publish-npm-sdk-staging.yml @@ -1,17 +1,8 @@ -name: Publish Package NPM - dataprotector +name: npm publish staging - dataprotector +description: Publish a staging version on npm on: workflow_dispatch: - inputs: - tag: - description: 'NPM tag to publish (latest or nightly)' - required: true - type: choice - options: - - latest - - nightly - - beta - default: nightly jobs: set-publish-version: @@ -25,31 +16,26 @@ jobs: uses: actions/setup-node@v4 - name: Set publish version id: set-publish-version - if: github.event.inputs.tag == 'nightly' working-directory: packages/sdk run: | - if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then - CURRENT_VERSION=$(npm pkg get version | tr -d '"') - NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}" - echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT - else - echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT - fi + CURRENT_VERSION=$(npm pkg get version | tr -d '"') + NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}" + echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT outputs: VERSION: ${{ steps.set-publish-version.outputs.VERSION }} publish-npm: # Run only on main branch if: github.ref == 'refs/heads/main' - uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.4.0 + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0 needs: set-publish-version with: scope: '@iexec/dataprotector-sdk' registry: 'https://registry.npmjs.org' node-version: '18' - environment: ${{ github.event.inputs.target }} + environment: 'staging' working-directory: packages/sdk - tag: ${{ github.event.inputs.tag }} + tag: 'nightly' version: ${{ needs.set-publish-version.outputs.VERSION }} install-command: | npm ci diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 000000000..183dfd791 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,17 @@ +name: release-please +description: triggers release-please to open the next release PR + +on: + push: + branches: + - main + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release-please: + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/release-please.yml@release-please-v2.1.0 + secrets: inherit diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..a38f18043 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + "packages/sdk": "2.0.0-beta.16" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..d270fc9ce --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "include-component-in-tag": false, + "changelog-sections": [ + { "type": "feat", "section": "Added", "hidden": false }, + + { "type": "fix", "section": "Changed", "hidden": false }, + { "type": "change", "section": "Changed", "hidden": false }, + { "type": "deprecate", "section": "Changed", "hidden": false }, + { "type": "revert", "section": "Changed", "hidden": false }, + { "type": "security", "section": "Changed", "hidden": false }, + { "type": "perf", "section": "Changed", "hidden": false }, + { "type": "refactor", "section": "Changed", "hidden": false }, + + { "type": "remove", "section": "Removed", "hidden": false }, + + { "type": "style", "section": "Misc", "hidden": true }, + { "type": "build", "section": "Misc", "hidden": true }, + { "type": "chore", "section": "Misc", "hidden": true }, + { "type": "test", "section": "Misc", "hidden": true }, + { "type": "deps", "section": "Misc", "hidden": true }, + { "type": "ci", "section": "Misc", "hidden": true }, + { "type": "docs", "section": "Misc", "hidden": true } + ], + "packages": { + "packages/sdk": { + "release-type": "node", + "changelog-path": "CHANGELOG.md", + "include-v-in-tag": true, + + "prerelease": true, + "prerelease-type": "beta", + "versioning": "prerelease" + } + } +}