Skip to content

Tried to organize functions in facets #570

Tried to organize functions in facets

Tried to organize functions in facets #570

Workflow file for this run

name: Release SDK & UI
env:
CI: false #Set back to true after fixing all warnings
FORCE_COLOR: true
on: [ push, pull_request ]
jobs:
workflow-setup:
name: Initialize Workflow
runs-on: ubuntu-latest
outputs:
publish: ${{ steps.build-flags.outputs.publish }}
steps:
- name: Set builds flags
id: build-flags
run: |
if [[ ${{github.event.repository.full_name}} == 'kumodao/kumo-protocol' && ${{github.event_name}} == 'push' && ( "${{github.base_ref}}" == 'main' || "${{github.ref}}" == 'refs/heads/main' ) ]]; then
echo "{publish}={true}" >> $GITHUB_OUTPUT
else
echo "{publish}={false}" >> $GITHUB_OUTPUT
fi
test:
name: Run SDK tests
runs-on: ubuntu-latest
needs: workflow-setup
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: 16.16.0
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Test SDK & UI
run: yarn test
# - name: Test SDK integration against live contracts
# if: ${{ github.ref == 'refs/heads/main' }}
# run: yarn test-live
release:
name: Publish SDK to NPM and build Frontend image
if: needs.workflow-setup.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [ workflow-setup, test ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: 16.16.0
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Release SDK on NPM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
- name: Convert the GitHub repository name to lowercase
id: repository-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.repository }}
- name: Prepare image labels and tags
if: ${{ github.event_name != 'pull_request' }}
id: prep
shell: bash
run: |
DOCKER_IMAGE=ghcr.io/${{ steps.repository-name.outputs.lowercase }}/dev-frontend
TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:latest"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Log into the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v1
- name: Build and push image
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v2
with:
context: ./packages/dev-frontend
no-cache: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}