Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish-release: | |
name: Publish release package | |
permissions: write-all | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: nix develop .#ci-default -c bash -xe {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: superfluid-finance/build-scripts | |
path: build-scripts | |
- uses: DeterminateSystems/nix-installer-action@v13 | |
- name: Parse Tag | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
run: | | |
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/ethereum-contracts@";then | |
echo "PUBLISH_ETHEREUM_CONTRACTS=1" >> "$GITHUB_ENV" | |
fi | |
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-core@";then | |
echo "PUBLISH_SDK_CORE=1" >> "$GITHUB_ENV" | |
fi | |
if echo -n "$GITHUB_REF" | grep -qE "refs/tags/sdk-redux@";then | |
echo "PUBLISH_SDK_REDUX=1" >> "$GITHUB_ENV" | |
fi | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Publish ethereum-contracts package | |
if: env.PUBLISH_ETHEREUM_CONTRACTS == 1 | |
run: | | |
yarn --cwd packages/ethereum-contracts build | |
tasks/npm-publish.sh packages/ethereum-contracts/ latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: Publish sdk-core package | |
id: publish-sdk-core | |
if: env.PUBLISH_SDK_CORE == 1 | |
run: | | |
yarn --cwd packages/sdk-core get-graphql-schema:v1 | |
yarn --cwd packages/ethereum-contracts build | |
yarn --cwd packages/sdk-core build | |
tasks/npm-publish.sh packages/sdk-core/ latest | |
PUBLISHED_VERSION=$(jq -r .version packages/sdk-core/package.json) | |
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT" | |
# Build documentation with redirect from root | |
yarn --cwd packages/sdk-core doc:html | |
mkdir sdk-core-redirect | |
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" \ | |
> sdk-core-redirect/index.html | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: Upload sdk-core HTML documentation | |
if: env.PUBLISH_SDK_CORE == 1 | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: packages/sdk-core/dist/docs | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-core@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-core.outputs.PUBLISHED_VERSION) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH | |
- name: Upload sdk-core latest documentation redirect | |
if: env.PUBLISH_SDK_CORE == 1 | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: sdk-core-redirect | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-core', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH | |
- name: Publish sdk-redux package | |
id: publish-sdk-redux | |
if: env.PUBLISH_SDK_REDUX == 1 | |
run: | | |
yarn --cwd packages/ethereum-contracts build | |
yarn --cwd packages/sdk-core get-graphql-schema:v1 | |
yarn --cwd packages/sdk-core build | |
yarn --cwd packages/sdk-redux build | |
tasks/npm-publish.sh packages/sdk-redux/ latest | |
PUBLISHED_VERSION=$(jq -r .version packages/sdk-redux/package.json) | |
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION" >> "$GITHUB_OUTPUT" | |
# Build documentation with redirect from root | |
yarn --cwd packages/sdk-redux doc:html | |
mkdir sdk-redux-redirect | |
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" \ | |
> sdk-redux-redirect/index.html | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} | |
- name: Upload sdk-redux HTML documentation | |
if: env.PUBLISH_SDK_REDUX == 1 | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: packages/sdk-redux/dist/docs | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-redux@{1}', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI, steps.publish-sdk-redux.outputs.PUBLISHED_VERSION) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH | |
- name: Upload sdk-redux latest documentation redirect | |
if: env.PUBLISH_SDK_REDUX == 1 | |
uses: ./build-scripts/s3cloudfront-hosting/actions/sync | |
with: | |
local_build_dir: sdk-redux-redirect | |
aws_region: eu-west-2 | |
aws_access_key_id: ${{ secrets.SITE_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.SITE_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
s3_uri: ${{ format('{0}sdk-redux', secrets.SITE_DEPLOYER_AWS_S3_DOCS_URI) }} | |
cloudfront_distribution_id: E3JEO5R14CT8IH |