-
Notifications
You must be signed in to change notification settings - Fork 63
ITSM-1219: Implement pipelines for publishing libs #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
e8e167e
ITSM-1219: Implement pipelines for publishing libs
dm3ch 9096180
ITSM-1219: WIP
dm3ch cb7caf9
ITSM-1219: WIP
dm3ch 4ac9009
ITSM-1219: WIP
dm3ch 1fee450
ITSM-1219: WIP
dm3ch 9d71a5b
chore(release):
1649083
ITSM-1219: WIP
dm3ch 3ae94c0
ITSM-1219: WIP
dm3ch 7bf3855
ITSM-1219: WIP
dm3ch c97aeaf
chore(release):
8860726
chore(release):
bec0e01
ITSM-1219: Add pipeline triggers for testing of new pipelines in a br…
dm3ch d7122c2
ITSM-1219: Add pipeline triggers for testing of new pipelines in a br…
dm3ch 91598de
chore(release):
05c494d
ITSM-1219: Add pipeline triggers for testing of new pipelines in a br…
dm3ch d90d130
chore(release):
b296b2b
ITSM-1219: WIP
dm3ch 63bba32
chore(release):
fc097f8
ITSM-1219: WIP
dm3ch 6290cb1
chore(release):
be22925
ITSM-1219: WIP
dm3ch 122b22d
ITSM-1219: WIP
dm3ch 058465c
chore(release):
76b21a9
ITSM-1219: WIP
dm3ch e256f80
chore(release):
a643850
ITSM-1219: WIP
dm3ch 06d4a89
chore(release):
c44e671
ITSM-1219: WIP
dm3ch adab821
chore(release):
dc4dde8
ITSM-1219: WIP
dm3ch 280c3ba
chore(release):
8c17170
ITSM-1219: WIP
dm3ch c3961b8
chore(release):
eaf9f03
Revert package version to master one
dm3ch de576ae
Update .github/workflows/release.yml
dm3ch 4c0f76d
Update .github/workflows/release.yml
dm3ch 719dd64
chore(release):
d131dc5
Revert package version to master one
dm3ch 9f92a27
Update .github/workflows/release.yml
dm3ch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,52 @@ | ||
| name: Release new version | ||
| name: Release typescript | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| sdk: | ||
| project: | ||
| type: choice | ||
| description: SDK to release | ||
| description: Library to release | ||
| required: true | ||
| options: | ||
| - aqua | ||
| - cross-chain | ||
| - fusion | ||
| - limit-order | ||
| - sdk-core | ||
| - swap-vm | ||
| version: | ||
| bump: | ||
| type: choice | ||
| description: Version bump type | ||
| description: Semver bump or custom | ||
| required: true | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| - prerelease | ||
| preid: | ||
| type: string | ||
| description: Prerelease identifier (used when bump = prerelease) | ||
| required: false | ||
| default: rc | ||
| dry_run: | ||
| type: boolean | ||
| description: Dry Run | ||
| required: false | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| actions: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| actions: write | ||
| outputs: | ||
| project: ${{ steps.pkg.outputs.project }} | ||
| sdk_path: ${{ steps.pkg.outputs.sdk_path }} | ||
| package_name: ${{ steps.pkg.outputs.package_name }} | ||
| pkg_version: ${{ steps.pkg.outputs.pkg_version }} | ||
| tag: ${{ steps.pkg.outputs.tag }} | ||
| steps: | ||
| - name: Checkout | ||
| - name: Checkout master | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
@@ -45,55 +60,144 @@ jobs: | |
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - name: Install Dev Dependencies | ||
| run: pnpm install -D | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Get SDK info | ||
| id: sdk_info | ||
| - name: Configure git | ||
| run: | | ||
| SDK_PATH="typescript/${{ github.event.inputs.sdk }}" | ||
| echo "SDK_PATH=$SDK_PATH" >> "$GITHUB_OUTPUT" | ||
| cd $SDK_PATH | ||
| echo "OLD_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT" | ||
| git config --global user.email "[email protected]" | ||
| git config --global user.name "CI/CD Bot" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
|
||
| - name: Bump package.json version | ||
| - name: Run Nx release | ||
| id: version | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| cd ${{ steps.sdk_info.outputs.SDK_PATH }} | ||
| pnpm version ${{ github.event.inputs.version }} --preid rc --git-tag-version=false | ||
| echo "NEW_VERSION=$(pnpm pkg get version | tr -d '"')" >> "$GITHUB_OUTPUT" | ||
| SPECIFIER="${{ inputs.bump }}" | ||
|
|
||
| PREID_FLAG="" | ||
| if [ "${{ inputs.bump }}" = "prerelease" ] && [ -n "${{ inputs.preid }}" ]; then | ||
| PREID_FLAG="--preid ${{ inputs.preid }}" | ||
| fi | ||
|
|
||
| - name: Generate changelog | ||
| DRY_RUN_FLAG="" | ||
| if [ "${{ inputs.dry_run }}" = "true" ]; then | ||
| DRY_RUN_FLAG="--dry-run" | ||
| fi | ||
|
|
||
| npx nx release "$SPECIFIER" \ | ||
| --projects="${{ inputs.project }}" \ | ||
| $PREID_FLAG \ | ||
| $DRY_RUN_FLAG \ | ||
| --skip-publish \ | ||
| --verbose | ||
|
|
||
| - name: Resolve package info | ||
| id: pkg | ||
| run: | | ||
| cd ${{ steps.sdk_info.outputs.SDK_PATH }} | ||
| # Try to generate changelog from the last tag for this SDK | ||
| LAST_TAG="${{ github.event.inputs.sdk }}-v${{ steps.sdk_info.outputs.OLD_VERSION }}" | ||
| pnpm changelog:generate -t $LAST_TAG || pnpm changelog:generate | ||
| SDK_PATH="typescript/${{ inputs.project }}" | ||
| PKG_NAME=$(node -p "require('./$SDK_PATH/package.json').name") | ||
| PKG_VERSION=$(node -p "require('./$SDK_PATH/package.json').version") | ||
| TAG="${{ inputs.project }}/v${PKG_VERSION}" | ||
|
|
||
| - name: Create github release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| echo "project=${{ inputs.project }}" >> "$GITHUB_OUTPUT" | ||
| echo "sdk_path=$SDK_PATH" >> "$GITHUB_OUTPUT" | ||
| echo "package_name=$PKG_NAME" >> "$GITHUB_OUTPUT" | ||
| echo "pkg_version=$PKG_VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Show updated version | ||
| run: | | ||
| git config --global user.email [email protected] | ||
| git config --global user.name "CI/CD Bot" | ||
|
|
||
| cd ${{ steps.sdk_info.outputs.SDK_PATH }} | ||
| git add package.json | ||
| git commit -m "version @1inch/${{ github.event.inputs.sdk }}-sdk v${{ steps.version.outputs.NEW_VERSION }}" | ||
|
|
||
| TAG_NAME="${{ github.event.inputs.sdk }}-v${{ steps.version.outputs.NEW_VERSION }}" | ||
| git tag $TAG_NAME | ||
| git push | ||
| git push --tags | ||
|
|
||
| if [ -f CHANGELOG.md ]; then | ||
| gh release create $TAG_NAME --notes-file CHANGELOG.md --title "@1inch/${{ github.event.inputs.sdk }}-sdk v${{ steps.version.outputs.NEW_VERSION }}" | ||
| else | ||
| gh release create $TAG_NAME --generate-notes --title "@1inch/${{ github.event.inputs.sdk }}-sdk v${{ steps.version.outputs.NEW_VERSION }}" | ||
| if [ "${{ inputs.dry_run }}" = "true" ]; then | ||
| echo "(dry-run: version on disk is unchanged)" | ||
| fi | ||
| echo "Version = ${{ steps.pkg.outputs.pkg_version }}" | ||
|
|
||
| publish-npmjs: | ||
| runs-on: ubuntu-latest | ||
| needs: release | ||
| if: ${{ github.event.inputs.dry_run != 'true' }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout tag | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.release.outputs.tag }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Trigger publish | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
| registry-url: https://registry.npmjs.org | ||
| always-auth: true | ||
|
|
||
| # Updating npm to 11 since it's minimal version supporting "npm publish" with OIDC token | ||
| - name: Install npm@11 | ||
| run: npm install -g npm@11 | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build package (pnpm) | ||
| run: pnpm --filter "${{ needs.release.outputs.package_name }}" build | ||
|
|
||
| - name: Publish to npmjs | ||
dm3ch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| working-directory: ${{ needs.release.outputs.sdk_path }} | ||
| run: | | ||
| TAG_ARG="" | ||
| if [ "${{ github.event.inputs.bump }}" = "prerelease" ]; then | ||
| TAG_ARG="--tag next" | ||
| fi | ||
|
|
||
| npm publish --access public --provenance $TAG_ARG | ||
|
|
||
| publish-github-packages: | ||
| runs-on: ubuntu-latest | ||
| needs: release | ||
| if: ${{ github.event.inputs.dry_run != 'true' }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout tag | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.release.outputs.tag }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build package (pnpm) | ||
| run: pnpm --filter "${{ needs.release.outputs.package_name }}" build | ||
|
|
||
| - name: Publish to GitHub Packages | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: gh workflow run publish.yml -r ${{ github.event.inputs.sdk }}-v${{ steps.version.outputs.NEW_VERSION }} | ||
| NODE_AUTH_TOKEN: ${{ github.token }} | ||
| working-directory: ${{ needs.release.outputs.sdk_path }} | ||
| run: | | ||
| npm config set @1inch:registry https://npm.pkg.github.com | ||
| npm config set //npm.pkg.github.com/:_authToken "${NODE_AUTH_TOKEN}" | ||
dm3ch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| npm publish --access public | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.