|
1 | 1 | name: Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - "*.*.*" |
7 |
| - - "v*.*.*" |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + types: [opened, synchronize, reopened, labeled, unlabeled] |
| 7 | + workflow_dispatch: # Allows manual invocation |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + actions: read |
| 12 | + checks: write |
| 13 | + pull-requests: write |
8 | 14 |
|
9 | 15 | jobs:
|
10 |
| - release: |
| 16 | + check-release-label: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + has-release-label: ${{ steps.check-release-label.outputs.has-release-label }} |
| 20 | + steps: |
| 21 | + - name: Check for run-ci label |
| 22 | + id: check-release-label |
| 23 | + run: | |
| 24 | + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci-release') }}" == "true" ]]; then |
| 25 | + echo "has-release-label=true" >> $GITHUB_OUTPUT |
| 26 | + else |
| 27 | + echo "has-release-label=false" >> $GITHUB_OUTPUT |
| 28 | + fi |
| 29 | +
|
| 30 | + build: |
| 31 | + needs: check-release-label |
| 32 | + if: needs.check-release-label.outputs.has-release-label == 'true' |
11 | 33 | runs-on: ubuntu-latest
|
12 |
| - environment: production |
13 | 34 | steps:
|
14 |
| - - name: Checkout Repository |
| 35 | + # https://github.com/actions/checkout |
| 36 | + - name: Checkout |
15 | 37 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
16 |
| - with: |
17 |
| - fetch-depth: 0 # Full history for changelog generation |
18 | 38 |
|
19 |
| - - name: Setup Node.js |
20 |
| - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 |
21 |
| - with: |
22 |
| - node-version-file: ".nvmrc" |
| 39 | + # Install and cache JS toolchain and dependencies (node_modules) |
| 40 | + - name: Setup JS |
| 41 | + uses: ./.github/actions/js-setup |
23 | 42 |
|
24 |
| - - name: Use corepack to activate pnpm |
25 |
| - run: npm i -g [email protected] && corepack enable |
26 |
| - shell: bash |
| 43 | + - name: Build |
| 44 | + run: pnpm run build-all |
27 | 45 |
|
28 |
| - - name: Audit dependencies (before installing anything) |
29 |
| - # Ignore "low" and "moderate" advisories for now. |
30 |
| - run: pnpm audit --audit-level high |
31 |
| - shell: bash |
| 46 | + - name: Typecheck |
| 47 | + run: pnpm run typecheck-all |
32 | 48 |
|
33 |
| - - name: Get pnpm store directory (for caching) |
34 |
| - id: pnpm-cache-dir |
35 |
| - run: | |
36 |
| - echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT |
37 |
| - shell: bash |
| 49 | + - name: Prettier |
| 50 | + run: pnpm run prettier-all:check |
38 | 51 |
|
39 |
| - # https://github.com/actions/cache |
40 |
| - - name: Setup pnpm store cache |
41 |
| - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
42 |
| - with: |
43 |
| - path: ${{ steps.pnpm-cache-dir.outputs.dir }} |
44 |
| - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
45 |
| - restore-keys: | |
46 |
| - ${{ runner.os }}-pnpm-store- |
| 52 | + test-pre-prod: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: build |
| 55 | + steps: |
| 56 | + - name: Test (preprod) |
| 57 | + run: anvil & pnpm run test-all && lsof -t -i tcp:8545 | xargs kill |
47 | 58 | env:
|
48 |
| - SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5 |
49 |
| - |
50 |
| - - name: Audit the lockfiles to catch peer dependency issues |
51 |
| - run: pnpm install -r --lockfile-only |
52 |
| - shell: bash |
| 59 | + API_PUBLIC_KEY: ${{ secrets.PREPROD_API_PUBLIC_KEY }} |
| 60 | + API_PRIVATE_KEY: ${{ secrets.PREPROD_API_PRIVATE_KEY }} |
| 61 | + BASE_URL: ${{ secrets.PREPROD_BASE_URL }} |
| 62 | + ORGANIZATION_ID: ${{ secrets.PREPROD_ORGANIZATION_ID }} |
| 63 | + PRIVATE_KEY_ID: ${{ secrets.PREPROD_PRIVATE_KEY_ID }} |
| 64 | + EXPECTED_PRIVATE_KEY_ETH_ADDRESS: ${{ secrets.PREPROD_EXPECTED_PRIVATE_KEY_ETH_ADDRESS }} |
| 65 | + EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2: ${{ secrets.PREPROD_EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2 }} |
| 66 | + EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS: ${{ secrets.PREPROD_EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS }} |
| 67 | + EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2: ${{ secrets.PREPROD_EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2 }} |
| 68 | + BANNED_TO_ADDRESS: ${{ secrets.PREPROD_BANNED_TO_ADDRESS }} |
| 69 | + SOLANA_TEST_ORG_API_PRIVATE_KEY: ${{ secrets.SOLANA_TEST_ORG_API_PRIVATE_KEY }} |
| 70 | + WALLET_ID: ${{ secrets.PREPROD_WALLET_ID }} |
53 | 71 |
|
54 |
| - - name: Install dependencies |
55 |
| - run: pnpm install -r --frozen-lockfile |
56 |
| - shell: bash |
| 72 | + test-prod: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: test-pre-prod |
| 75 | + steps: |
| 76 | + - name: Test (prod) |
| 77 | + run: anvil & pnpm run test-all && lsof -t -i tcp:8545 | xargs kill |
| 78 | + env: |
| 79 | + API_PUBLIC_KEY: ${{ secrets.API_PUBLIC_KEY }} |
| 80 | + API_PRIVATE_KEY: ${{ secrets.API_PRIVATE_KEY }} |
| 81 | + BASE_URL: "https://api.turnkey.com" |
| 82 | + ORGANIZATION_ID: ${{ secrets.ORGANIZATION_ID }} |
| 83 | + PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }} |
| 84 | + EXPECTED_PRIVATE_KEY_ETH_ADDRESS: ${{ secrets.EXPECTED_PRIVATE_KEY_ETH_ADDRESS }} |
| 85 | + EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2: ${{ secrets.EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2 }} |
| 86 | + EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS: ${{ secrets.EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS }} |
| 87 | + EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2: ${{ secrets.EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2 }} |
| 88 | + BANNED_TO_ADDRESS: "0x6F72eDB2429820c2A0606a9FC3cA364f5E9b2375" |
| 89 | + SOLANA_TEST_ORG_API_PRIVATE_KEY: ${{ secrets.SOLANA_TEST_ORG_API_PRIVATE_KEY }} |
| 90 | + WALLET_ID: ${{ secrets.WALLET_ID }} |
57 | 91 |
|
58 |
| - - name: Create PR with changelog |
| 92 | + publish: |
| 93 | + runs-on: ubuntu-latest |
| 94 | + environment: production # require manual approval for production deployments |
| 95 | + needs: test-prod |
| 96 | + steps: |
| 97 | + - name: Publish @turnkey/sdk-types to npm |
59 | 98 | uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10
|
60 | 99 | with:
|
61 |
| - version: pnpm run changeset version # Updates versions and changelog |
62 |
| - publish: pnpm run changeset publish # Publishes to npm |
| 100 | + version: pnpm --filter @turnkey/sdk-types run changeset version # Updates versions and changelog |
| 101 | + publish: pnpm --filter @turnkey/sdk-types publish --dry-run # dry run publish to npm |
63 | 102 | env:
|
64 | 103 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For changelog links
|
65 |
| - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # For npm publish |
| 104 | + NPM_TOKEN: ${{ env.NPM_TOKEN }} # for npm publish |
| 105 | + - name: Publish to npm (Push) |
| 106 | + uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10 |
| 107 | + with: |
| 108 | + version: pnpm --filter @turnkey/sdk-types run changeset version |
| 109 | + publish: pnpm --filter @turnkey/sdk-types publish |
| 110 | + env: |
| 111 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + NPM_TOKEN: ${{ env.NPM_TOKEN }} |
0 commit comments