Skip to content

[Inspector] comap's transactions guessed as group's txs #4886

[Inspector] comap's transactions guessed as group's txs

[Inspector] comap's transactions guessed as group's txs #4886

Workflow file for this run

name: Pre-Publish tagged Pull Requests
concurrency:
# For pushes, this lets concurrent runs happen, so each push gets a result.
# But for other events (e.g. PRs), we can cancel the previous runs.
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
build_napi:
name: Build NAPI
uses: ./.github/workflows/napi-build-reusable.yml
if: contains(github.event.pull_request.labels.*.name, 'pre-release')
with:
concurrency: pre-release-napi
disableTest: true
build_rn:
name: Build React Native
uses: ./.github/workflows/rn-build-reusable.yml
if: contains(github.event.pull_request.labels.*.name, 'pre-release')
with:
concurrency: pre-release-rn
pre-release:
if: contains(github.event.pull_request.labels.*.name, 'pre-release')
needs: [build_napi, build_rn]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Source Code
uses: ./.github/actions/source-code/
- name: Pnpm Build
run: pnpm turbo build --filter="./packages/*"
- name: Build NAPI
run: pnpm turbo build:napi
- name: Download NAPI Artifacts (binaries) from build_napi workflow
uses: actions/download-artifact@v5
with:
path: crates/cojson-core-napi/artifacts
- name: Move artifacts and copy binaries into corresponding binary package inside npm directory
run: pnpm artifacts
working-directory: crates/cojson-core-napi/artifacts
- name: List NAPI packages and binaries
run: ls .
shell: bash
working-directory: crates/cojson-core-napi
- name: Download React Native Android artifacts
uses: actions/download-artifact@v5
with:
name: cojson-core-rn-android
path: crates/cojson-core-rn
- name: Download React Native iOS artifacts
uses: actions/download-artifact@v5
with:
name: cojson-core-rn-ios
path: crates/cojson-core-rn
- name: List React Native artifacts
run: |
ls -R crates/cojson-core-rn/CojsonCoreRnFramework.xcframework
ls -R crates/cojson-core-rn/android/src/main/jniLibs
ls -R crates/cojson-core-rn/ios
shell: bash
- name: Pre publish
run: pnpm exec pkg-pr-new publish --json output.json --comment=off "./crates/cojson-core-napi/npm/*" "./crates/cojson-core-napi" "./crates/cojson-core-wasm" "./crates/cojson-core-rn" "./packages/*"
- name: Post or update comment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
const packages = output.packages
.map((p) => `- ${p.name}: ${p.url}`)
.join('\n');
const sha =
context.event_name === 'pull_request'
? context.payload.pull_request.head.sha
: context.payload.after;
const resolutions = Object.fromEntries(
output.packages.map((p) => [p.name, p.url])
);
const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`;
const body = `## Jazz pre-release
### Packages:
\`\`\`json
${JSON.stringify(resolutions, null, 4)}
\`\`\`
[View Commit](${commitUrl})`;
async function logPublishInfo() {
console.log('\n' + '='.repeat(50));
console.log('Publish Information');
console.log('='.repeat(50));
console.log('\nPublished Packages:');
console.log(output.packages);
console.log('\nTemplates:');
console.log(templates);
console.log(`\nCommit URL: ${commitUrl}`);
console.log('\n' + '='.repeat(50));
}
if (context.eventName === 'pull_request') {
if (context.issue.number) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
}
} else if (context.eventName === 'push') {
const pullRequests = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${context.ref.replace(
'refs/heads/',
''
)}`,
});
if (pullRequests.data.length > 0) {
await github.rest.issues.createComment({
issue_number: pullRequests.data[0].number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body,
});
} else {
console.log(
'No open pull request found for this push. Logging publish information to console:'
);
await logPublishInfo();
}
}