|
1 | | -name: CI | Canary (Dev) |
| 1 | +name: Publisher & CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: ["dev"] |
6 | 6 | paths: |
7 | | - - ".github/workflows/ci.canary.yml" |
| 7 | + - ".github/workflows/handler.publish-dev-release-packages.yml" |
8 | 8 | - ".github/workflows/call.*.yml" |
9 | 9 | - "package.json" |
10 | 10 | - "yarn.lock" |
11 | 11 | - "packages/**" |
12 | 12 | - "codecov.yml" |
13 | 13 | # - "**.md" are commented out because docs updates should go into the packages |
| 14 | + release: |
| 15 | + types: [published] |
14 | 16 |
|
15 | 17 | jobs: |
16 | 18 | check: |
17 | 19 | name: Checking what packages need to be built |
| 20 | + if: github.event_name == 'push' |
18 | 21 |
|
19 | 22 | runs-on: ubuntu-22.04 |
20 | 23 |
|
@@ -139,7 +142,7 @@ jobs: |
139 | 142 | name: All packages tested (Dev Branch) |
140 | 143 | runs-on: ubuntu-22.04 |
141 | 144 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs |
142 | | - if: ${{ always() }} |
| 145 | + if: ${{ always() && github.event_name == 'push' }} |
143 | 146 |
|
144 | 147 | needs: [ test-spec-haskell |
145 | 148 | , test-solidity-semantic-money |
@@ -175,12 +178,12 @@ jobs: |
175 | 178 |
|
176 | 179 | publish-npm-packages: |
177 | 180 | name: Publish canary packages to registries |
| 181 | + # Only run this if we are in a push event (canary flow) |
| 182 | + if: github.event_name == 'push' |
178 | 183 |
|
179 | 184 | permissions: |
180 | 185 | contents: read |
181 | 186 | id-token: write |
182 | | - |
183 | | - |
184 | 187 | needs: [all-packages-tested] |
185 | 188 |
|
186 | 189 | runs-on: ubuntu-22.04 |
@@ -221,6 +224,8 @@ jobs: |
221 | 224 |
|
222 | 225 | publish-sdk-html-docs: |
223 | 226 | name: Publish canary HTML docs |
| 227 | + # Only run this if we are in a push event |
| 228 | + if: github.event_name == 'push' |
224 | 229 |
|
225 | 230 | needs: [all-packages-tested] |
226 | 231 |
|
@@ -313,3 +318,142 @@ jobs: |
313 | 318 | RELEASE_VERSION: canary |
314 | 319 | OPTIMISM_SEPOLIA_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }} |
315 | 320 | OPTIMISM_SEPOLIA_PROVIDER_URL: ${{ secrets.OPTIMISM_SEPOLIA_PROVIDER_URL }} |
| 321 | + |
| 322 | + publish-release: |
| 323 | + name: Publish release package |
| 324 | + if: github.event_name == 'release' |
| 325 | + |
| 326 | + permissions: |
| 327 | + contents: read |
| 328 | + id-token: write |
| 329 | + |
| 330 | + runs-on: ubuntu-22.04 |
| 331 | + |
| 332 | + defaults: |
| 333 | + run: |
| 334 | + shell: nix develop .#ci-default -c bash -xe {0} |
| 335 | + |
| 336 | + steps: |
| 337 | + - uses: actions/checkout@v4 |
| 338 | + |
| 339 | + - uses: actions/checkout@v4 |
| 340 | + with: |
| 341 | + repository: superfluid-finance/build-scripts |
| 342 | + path: build-scripts |
| 343 | + |
| 344 | + - uses: DeterminateSystems/nix-installer-action@v13 |
| 345 | + |
| 346 | + - name: Parse Tag |
| 347 | + env: |
| 348 | + GITHUB_REF: ${{ github.ref }} |
| 349 | + run: | |
| 350 | + if echo -n "$GITHUB_REF" | grep -qE "refs/tags/ethereum-contracts@";then |
| 351 | + echo "PUBLISH_ETHEREUM_CONTRACTS=1" >> "$GITHUB_ENV" |
| 352 | + fi |
| 353 | + if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-core@";then |
| 354 | + echo "PUBLISH_SDK_CORE=1" >> "$GITHUB_ENV" |
| 355 | + fi |
| 356 | + if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-redux@";then |
| 357 | + echo "PUBLISH_SDK_REDUX=1" >> "$GITHUB_ENV" |
| 358 | + fi |
| 359 | +
|
| 360 | + - name: Install dependencies |
| 361 | + run: yarn install --frozen-lockfile |
| 362 | + |
| 363 | + - name: Publish ethereum-contracts package |
| 364 | + if: env.PUBLISH_ETHEREUM_CONTRACTS == 1 |
| 365 | + run: | |
| 366 | + yarn --cwd packages/ethereum-contracts build |
| 367 | + tasks/npm-publish.sh packages/ethereum-contracts/ latest |
| 368 | + env: |
| 369 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 370 | + NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} |
| 371 | + |
| 372 | + - name: Publish sdk-core package |
| 373 | + id: publish-sdk-core |
| 374 | + if: env.PUBLISH_SDK_CORE == 1 |
| 375 | + run: | |
| 376 | + yarn --cwd packages/sdk-core get-graphql-schema:v1 |
| 377 | + yarn --cwd packages/ethereum-contracts build |
| 378 | + yarn --cwd packages/sdk-core build |
| 379 | + tasks/npm-publish.sh packages/sdk-core/ latest |
| 380 | +
|
| 381 | + PUBLISHED_VERSION=$(jq -r .version packages/sdk-core/package.json) |
| 382 | +
|
| 383 | + echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT" |
| 384 | +
|
| 385 | + # Build documentation with redirect from root |
| 386 | + yarn --cwd packages/sdk-core doc:html |
| 387 | + mkdir sdk-core-redirect |
| 388 | + printf '<!DOCTYPE html><html><head><title>Redirecting...</title><meta charset="UTF-8"><meta http-equiv="refresh" content="0;URL=%s" /><meta http-equiv="Cache-Control" content="no-store" /></head><body><p>Redirecting to latest documentation...</p></body></html>' "https://refs.superfluid.finance/sdk-core@$PUBLISHED_VERSION" \ |
| 389 | + > sdk-core-redirect/index.html |
| 390 | + env: |
| 391 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 392 | + NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} |
| 393 | + |
| 394 | + - name: Upload sdk-core HTML documentation |
| 395 | + if: env.PUBLISH_SDK_CORE == 1 |
| 396 | + uses: ./build-scripts/s3cloudfront-hosting/actions/sync |
| 397 | + with: |
| 398 | + local_build_dir: packages/sdk-core/dist/docs |
| 399 | + aws_region: eu-west-2 |
| 400 | + aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} |
| 401 | + aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} |
| 402 | + s3_uri: ${{ format('{0}sdk-core@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-core.outputs.PUBLISHED_VERSION) }} |
| 403 | + cloudfront_distribution_id: E3JEO5R14CT8IH |
| 404 | + |
| 405 | + - name: Upload sdk-core latest documentation redirect |
| 406 | + if: env.PUBLISH_SDK_CORE == 1 |
| 407 | + uses: ./build-scripts/s3cloudfront-hosting/actions/sync |
| 408 | + with: |
| 409 | + local_build_dir: sdk-core-redirect |
| 410 | + aws_region: eu-west-2 |
| 411 | + aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} |
| 412 | + aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} |
| 413 | + s3_uri: ${{ format('{0}sdk-core', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} |
| 414 | + cloudfront_distribution_id: E3JEO5R14CT8IH |
| 415 | + |
| 416 | + - name: Publish sdk-redux package |
| 417 | + id: publish-sdk-redux |
| 418 | + if: env.PUBLISH_SDK_REDUX == 1 |
| 419 | + run: | |
| 420 | + yarn --cwd packages/ethereum-contracts build |
| 421 | + yarn --cwd packages/sdk-core get-graphql-schema:v1 |
| 422 | + yarn --cwd packages/sdk-core build |
| 423 | + yarn --cwd packages/sdk-redux build |
| 424 | + tasks/npm-publish.sh packages/sdk-redux/ latest |
| 425 | +
|
| 426 | + PUBLISHED_VERSION=$(jq -r .version packages/sdk-redux/package.json) |
| 427 | +
|
| 428 | + echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT" |
| 429 | +
|
| 430 | + # Build documentation with redirect from root |
| 431 | + yarn --cwd packages/sdk-redux doc:html |
| 432 | + mkdir sdk-redux-redirect |
| 433 | + printf '<!DOCTYPE html><html><head><title>Redirecting...</title><meta charset="UTF-8"><meta http-equiv="refresh" content="0;URL=%s" /><meta http-equiv="Cache-Control" content="no-store" /></head><body><p>Redirecting to latest documentation...</p></body></html>' "https://refs.superfluid.finance/sdk-redux@$PUBLISHED_VERSION" \ |
| 434 | + > sdk-redux-redirect/index.html |
| 435 | + env: |
| 436 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 437 | + NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} |
| 438 | + |
| 439 | + - name: Upload sdk-redux HTML documentation |
| 440 | + if: env.PUBLISH_SDK_REDUX == 1 |
| 441 | + uses: ./build-scripts/s3cloudfront-hosting/actions/sync |
| 442 | + with: |
| 443 | + local_build_dir: packages/sdk-redux/dist/docs |
| 444 | + aws_region: eu-west-2 |
| 445 | + aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} |
| 446 | + aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} |
| 447 | + s3_uri: ${{ format('{0}sdk-redux@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-redux.outputs.PUBLISHED_VERSION) }} |
| 448 | + cloudfront_distribution_id: E3JEO5R14CT8IH |
| 449 | + |
| 450 | + - name: Upload sdk-redux latest documentation redirect |
| 451 | + if: env.PUBLISH_SDK_REDUX == 1 |
| 452 | + uses: ./build-scripts/s3cloudfront-hosting/actions/sync |
| 453 | + with: |
| 454 | + local_build_dir: sdk-redux-redirect |
| 455 | + aws_region: eu-west-2 |
| 456 | + aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} |
| 457 | + aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} |
| 458 | + s3_uri: ${{ format('{0}sdk-redux', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} |
| 459 | + cloudfront_distribution_id: E3JEO5R14CT8IH |
0 commit comments