Skip to content

Commit bc70bfb

Browse files
authored
Integrate changesets into monorepo (#680)
1 parent 6210d2b commit bc70bfb

File tree

44 files changed

+942
-282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+942
-282
lines changed

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "orca-so/whirlpools" }
6+
],
7+
"commit": false,
8+
"fixed": [["@orca-so/whirlpools-docs*"]],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.changeset/tame-badgers-arrive.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
"@orca-so/whirlpools-example-rust-repositioning-bot": patch
3+
"@orca-so/whirlpools-sdk": patch
4+
"@orca-so/whirlpools-rust-integration": patch
5+
"@orca-so/whirlpools-program": patch
6+
"@orca-so/whirlpools-rust": patch
7+
"@orca-so/whirlpools-integration": patch
8+
"@orca-so/whirlpools": patch
9+
"@orca-so/whirlpools-rust-client": patch
10+
"@orca-so/whirlpools-rust-macros": patch
11+
"@orca-so/whirlpools-docs": patch
12+
"@orca-so/whirlpools-sdk-cli": patch
13+
"@orca-so/whirlpools-rust-core": patch
14+
"@orca-so/whirlpools-client": patch
15+
"@orca-so/whirlpools-docs-legacy": patch
16+
"@orca-so/whirlpools-core": patch
17+
"@orca-so/whirlpools-lint": patch
18+
"@orca-so/whirlpools-docs-rust": patch
19+
"@orca-so/whirlpools-docs-ts": patch
20+
"@orca-so/whirlpools-example-ts-next": patch
21+
"@orca-so/common-sdk": patch
22+
"@orca-so/whirlpools-sdk-integration": patch
23+
---
24+
25+
Initial changeset version

.github/actions/anchor/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ runs:
5353
with:
5454
node-version: ${{ inputs.node-version }}
5555
cache: 'yarn'
56+
registry-url: 'https://registry.npmjs.org'
5657
- name: Install Solana CLI
5758
run: |
5859
wget -qO- "https://release.anza.xyz/${{ inputs.solana-version }}/solana-release-x86_64-unknown-linux-gnu.tar.bz2" | tar -xvj

.github/actions/cleanup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Setup Version in monorepo'
2-
description: 'Set version of all packages in monorepo.'
1+
name: 'Cleanup'
2+
description: 'Remove unnecessary files from the build environment.'
33

44
branding:
55
icon: trash-2

.github/actions/sync/action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Sync Versions'
2+
description: 'Sync npm verison numbers with other package managers.'
3+
4+
branding:
5+
icon: refresh-cw
6+
color: green
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Sync Cargo Versions
12+
run: |
13+
find . -type f -name "package.json" -not -path "*/node_modules/*" -exec sh -c '
14+
for file do
15+
cargo_file=$(dirname "$file")/Cargo.toml
16+
version=$(jq -r ".version" "$file")
17+
if [ -f "$cargo_file" ]; then
18+
awk -v version="$version" '\''
19+
/^\[package\]/ { in_package=1 }
20+
/^\[/ && !/^\[package\]/ { in_package=0 }
21+
in_package && /^version = / { sub(/".*"/, "\"" version "\"") } { print }
22+
'\'' "$cargo_file" > tmp.toml && mv tmp.toml "$cargo_file"
23+
fi
24+
done
25+
' _ {} +
26+
shell: bash
27+
- name: Push Changes
28+
run: |
29+
if [[ $(git status --porcelain) ]]; then
30+
git add **/Cargo.toml
31+
git commit -m "Sync cargo versions"
32+
git push
33+
fi
34+
shell: bash

.github/actions/version/action.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/dependabot.yml renamed to .github/workflows/automerge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Dependabot
1+
name: Automerge
22

33
on:
44
pull_request:
@@ -8,7 +8,7 @@ jobs:
88

99
automerge:
1010
runs-on: ubuntu-latest
11-
if: ${{ github.actor == 'dependabot[bot]' }}
11+
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'github-actions[bot]' }}
1212
permissions:
1313
pull-requests: write
1414
contents: write

.github/workflows/checks.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,16 @@ jobs:
4747
run: yarn install
4848
- name: Run Lint
4949
run: yarn lint --output-style static
50+
51+
changeset:
52+
runs-on: ubuntu-latest
53+
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' }}
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
- name: Install dependencies
60+
run: yarn install
61+
- name: Check changesets
62+
run: yarn changeset status --since origin/main

.github/workflows/docs.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 26 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,35 @@ name: Publish
22

33
on:
44
push:
5-
tags:
6-
- 'v[0-9]+.[0-9]+.[0-9]+'
5+
branches: [main]
76

8-
jobs:
9-
10-
npm:
11-
strategy:
12-
matrix:
13-
package: [core, client, whirlpool]
14-
max-parallel: 1
15-
fail-fast: true
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout Repository
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
- name: Setup Anchor
23-
uses: ./.github/actions/anchor
24-
- name: Set Version
25-
uses: ./.github/actions/version
26-
with:
27-
version: ${{ github.ref }}
28-
manifest-file: ts-sdk/${{ matrix.package }}/package.json
29-
- name: Setup npm
30-
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
31-
- name: Setup yarn
32-
run: yarn config set enableImmutableInstalls false
33-
- name: Install dependencies
34-
run: yarn install
35-
- name: Build package
36-
run: yarn build ts-sdk/${{ matrix.package }} --output-style static
37-
- name: Publish package
38-
working-directory: ts-sdk/${{ matrix.package }}
39-
run: npm publish --access public
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
408

41-
cargo:
42-
strategy:
43-
matrix:
44-
package: [macros, core, client, whirlpool]
45-
max-parallel: 1
46-
fail-fast: true
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout Repository
50-
uses: actions/checkout@v4
51-
with:
52-
fetch-depth: 0
53-
- name: Setup Anchor
54-
uses: ./.github/actions/anchor
55-
- name: Set Version
56-
uses: ./.github/actions/version
57-
with:
58-
version: ${{ github.ref }}
59-
manifest-file: rust-sdk/${{ matrix.package }}/Cargo.toml
60-
- name: Install dependencies
61-
run: yarn install
62-
- name: Build package
63-
run: yarn build rust-sdk/${{ matrix.package }} --output-style static
64-
- name: Publish package
65-
working-directory: rust-sdk/${{ matrix.package }}
66-
run: cargo publish --allow-dirty
67-
env:
68-
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
69-
70-
idl:
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: Checkout Repository
74-
uses: actions/checkout@v4
75-
with:
76-
fetch-depth: 0
77-
- name: Setup Anchor
78-
uses: ./.github/actions/anchor
79-
- name: Build idl
80-
run: anchor build
81-
- name: Upload artifacts
82-
uses: actions/upload-artifact@v4
83-
with:
84-
name: idl
85-
path: target/idl/*.json
86-
if-no-files-found: error
87-
88-
release:
89-
needs: [npm, cargo, idl]
9+
jobs:
10+
publish:
9011
runs-on: ubuntu-latest
9112
permissions:
9213
contents: write
14+
pull-requests: write
15+
outputs:
16+
published: ${{ steps.changesets.outputs.published }}
9317
steps:
94-
- name: Download artifacts
95-
uses: actions/download-artifact@v4
96-
id: idl
97-
with:
98-
name: idl
99-
- name: Create Release Name
100-
id: name
101-
run: echo "NAME=SDK - $(basename ${{ github.ref_name }})" >> $GITHUB_OUTPUT
102-
- name: Create Release
103-
uses: ncipollo/release-action@v1
104-
with:
105-
name: ${{ steps.name.outputs.NAME }}
106-
generateReleaseNotes: true
107-
allowUpdates: true
108-
artifacts: ${{ steps.idl.outputs.download-path }}/idl.zip
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
- name: Setup Anchor
21+
uses: ./.github/actions/anchor
22+
- name: Install dependencies
23+
run: yarn install
24+
- name: Create Release Pull Request or Publish
25+
id: changesets
26+
uses: changesets/action@v1
27+
with:
28+
commit: 'Publish packages'
29+
title: 'Publish packages'
30+
publish: 'yarn publish'
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
35+
- name: Update Cargo Version Numbers
36+
uses: ./.github/actions/sync

0 commit comments

Comments
 (0)