Skip to content

Commit ba42987

Browse files
committed
test workflow
1 parent a4c16c3 commit ba42987

File tree

2 files changed

+169
-25
lines changed

2 files changed

+169
-25
lines changed

.github/workflows/ci.canary.yml renamed to .github/workflows/handler.publish-dev-release-packages.yml

Lines changed: 149 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
name: CI | Canary (Dev)
1+
name: Publisher & CI
22

33
on:
44
push:
55
branches: ["dev"]
66
paths:
7-
- ".github/workflows/ci.canary.yml"
7+
- ".github/workflows/handler.publish-dev-release-packages.yml"
88
- ".github/workflows/call.*.yml"
99
- "package.json"
1010
- "yarn.lock"
1111
- "packages/**"
1212
- "codecov.yml"
1313
# - "**.md" are commented out because docs updates should go into the packages
14+
release:
15+
types: [published]
1416

1517
jobs:
1618
check:
1719
name: Checking what packages need to be built
20+
if: github.event_name == 'push'
1821

1922
runs-on: ubuntu-22.04
2023

@@ -139,7 +142,7 @@ jobs:
139142
name: All packages tested (Dev Branch)
140143
runs-on: ubuntu-22.04
141144
# 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' }}
143146

144147
needs: [ test-spec-haskell
145148
, test-solidity-semantic-money
@@ -175,12 +178,12 @@ jobs:
175178
176179
publish-npm-packages:
177180
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'
178183

179184
permissions:
180185
contents: read
181186
id-token: write
182-
183-
184187
needs: [all-packages-tested]
185188

186189
runs-on: ubuntu-22.04
@@ -221,6 +224,8 @@ jobs:
221224

222225
publish-sdk-html-docs:
223226
name: Publish canary HTML docs
227+
# Only run this if we are in a push event
228+
if: github.event_name == 'push'
224229

225230
needs: [all-packages-tested]
226231

@@ -313,3 +318,142 @@ jobs:
313318
RELEASE_VERSION: canary
314319
OPTIMISM_SEPOLIA_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }}
315320
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

tasks/daily-slack-bot.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const sadPepeKidImage =
1717
"https://www.pngmart.com/files/11/Sad-Pepe-The-Frog-PNG-Transparent-Picture.png";
1818
const topSectionMessage =
1919
"Looks like there are some lonely pull requests open in your area";
20-
const workflowFileName = ".github/workflows/ci.canary.yml";
20+
const workflowFileName = ".github/workflows/handler.publish-dev-release-packages.yml";
2121
const metadataLink =
2222
"https://raw.githubusercontent.com/superfluid-finance/protocol-monorepo/dev/packages/metadata/networks.json";
2323
const redImage =
@@ -1620,8 +1620,8 @@ async function checkIndividualContractVerification(
16201620
const lastWorkflowId = lastWorkflow.id;
16211621
const lastWorkflowUsage = await getDataAsJson(
16221622
"https://api.github.com/repos/superfluid-finance/protocol-monorepo/actions/runs/" +
1623-
lastWorkflowId +
1624-
"/timing",
1623+
lastWorkflowId +
1624+
"/timing",
16251625
);
16261626

16271627
const workflowStatus = lastWorkflow.status;
@@ -1642,8 +1642,8 @@ async function checkIndividualContractVerification(
16421642
async function getPrOldestCommit(prJson) {
16431643
let allCommits = await getDataAsJson(
16441644
"https://api.github.com/repos/superfluid-finance/protocol-monorepo/pulls/" +
1645-
prJson.number +
1646-
"/commits",
1645+
prJson.number +
1646+
"/commits",
16471647
);
16481648
return allCommits[allCommits.length - 1];
16491649
}
@@ -1835,14 +1835,14 @@ async function checkIndividualContractVerification(
18351835
addSectionWithImage(
18361836
webhookPayload,
18371837
"Please have a look at: *<" +
1838-
oldestDraftPRUrl +
1839-
"|" +
1840-
oldestDraftPRTitle +
1841-
">*\nColumbus would have went to America " +
1842-
americaTrips +
1843-
" times already by this time ,do something with this as this has been open for *" +
1844-
lastDraftPrUpdateBeforeDays +
1845-
"* days",
1838+
oldestDraftPRUrl +
1839+
"|" +
1840+
oldestDraftPRTitle +
1841+
">*\nColumbus would have went to America " +
1842+
americaTrips +
1843+
" times already by this time ,do something with this as this has been open for *" +
1844+
lastDraftPrUpdateBeforeDays +
1845+
"* days",
18461846
redWarningIcon,
18471847
"It took them 36 days",
18481848
);
@@ -1867,10 +1867,10 @@ async function checkIndividualContractVerification(
18671867
} else {
18681868
let draftMessage = oldestDraftPR
18691869
? "There are no open PRs????? *<" +
1870-
allPullRequests +
1871-
"|" +
1872-
amountOfDraftPRs +
1873-
" pull requests are in draft , you might want to look into those>*"
1870+
allPullRequests +
1871+
"|" +
1872+
amountOfDraftPRs +
1873+
" pull requests are in draft , you might want to look into those>*"
18741874
: "There are no open and draft PRs? What is this, why u no work, you might want to read this:\n*<https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request|How to create a pull request>*";
18751875
addSectionWithImage(
18761876
webhookPayload,
@@ -1901,9 +1901,9 @@ async function checkIndividualContractVerification(
19011901
addContextWithImage(
19021902
webhookPayload,
19031903
"*The PR has been last updated before " +
1904-
lastUpdatedBeforeDays +
1905-
" days*\nLast commit: " +
1906-
oldestPRMessage,
1904+
lastUpdatedBeforeDays +
1905+
" days*\nLast commit: " +
1906+
oldestPRMessage,
19071907
imageToAddToContext,
19081908
imageText,
19091909
);

0 commit comments

Comments
 (0)