forked from Uniswap/interface
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85d8566
commit 44e498f
Showing
7 changed files
with
123 additions
and
144 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/abis/typse | ||
src/types/v3 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
name: Release | ||
on: | ||
schedule: | ||
- cron: '0 12 * * 1-4' # every day 12:00 UTC Monday-Thursday | ||
# manual trigger | ||
workflow_dispatch: | ||
push: | ||
# Publish `main` as Docker `latest` image. | ||
branches: | ||
- main | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
# Build and test PRs. | ||
pull_request: | ||
|
||
jobs: | ||
wait-on-tests: | ||
|
@@ -22,101 +29,80 @@ jobs: | |
- if: steps.unit-tests.outputs.conclusion != 'success' || steps.cypress-tests.outputs.conclusion != 'success' | ||
run: exit 1 | ||
|
||
tag: | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
push: | ||
# Ensure test job passes before pushing image. | ||
needs: wait-on-tests | ||
|
||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
new_tag: ${{ steps.github-tag-action.outputs.new_tag }} | ||
changelog: ${{ steps.github-tag-action.outputs.changelog }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Bump and tag | ||
id: github-tag-action | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
release_branches: .* | ||
default_bump: patch | ||
image_id: ${{ steps.push.outputs.image_id }} | ||
version: ${{ steps.push.outputs.version }} | ||
ipfs_hash: ${{ steps.push.outputs.ipfs_hash }} | ||
|
||
release: | ||
needs: tag | ||
if: ${{ needs.tag.outputs.new_tag != null }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- run: yarn prepare | ||
- run: yarn build | ||
|
||
- name: Pin to IPFS | ||
id: pinata | ||
uses: anantaramdas/ipfs-pinata-deploy-action@39bbda1ce1fe24c69c6f57861b8038278d53688d | ||
with: | ||
pin-name: Uniswap ${{ needs.tag.outputs.new_tag }} | ||
path: './build' | ||
pinata-api-key: ${{ secrets.PINATA_API_KEY }} | ||
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} | ||
|
||
- name: Pin to Crust | ||
uses: crustio/[email protected] | ||
continue-on-error: true | ||
timeout-minutes: 2 | ||
with: | ||
cid: ${{ steps.upload.outputs.hash }} | ||
seeds: ${{ secrets.CRUST_SEEDS }} | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Convert CIDv0 to CIDv1 | ||
id: convert-cidv0 | ||
uses: uniswap/[email protected] | ||
with: | ||
cidv0: ${{ steps.pinata.outputs.hash }} | ||
- name: Set IMAGE_TAG | ||
run: echo "IMAGE_TAG=$(echo ${{ github.repository }} | tr '[A-Z]' '[a-z]')" >> $GITHUB_ENV | ||
|
||
- uses: actions/cache@v3 | ||
id: cypress-cache | ||
with: | ||
path: /home/runner/.cache/Cypress | ||
key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }} | ||
- if: steps.cypress-cache.outputs.cache-hit != 'true' | ||
run: yarn cypress install | ||
- uses: cypress-io/github-action@v4 | ||
with: | ||
install: false | ||
browser: chrome | ||
config-file: cypress.release.config.ts | ||
config: baseUrl=https://cloudflare-ipfs.com/ipfs/${{ steps.pinata.outputs.hash }} | ||
- name: Build image | ||
run: docker image build . --file Dockerfile --tag $IMAGE_TAG | ||
|
||
- name: Update DNS with new IPFS hash | ||
env: | ||
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | ||
RECORD_DOMAIN: 'uniswap.org' | ||
RECORD_NAME: '_dnslink.app' | ||
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | ||
uses: textileio/cloudflare-update-dnslink@0fe7b7a1ffc865db3a4da9773f0f987447ad5848 | ||
with: | ||
cid: ${{ steps.pinata.outputs.hash }} | ||
- name: Log into registry | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
run: echo "${{ secrets.ContainerRegistry }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
id: push | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | ||
run: | | ||
IMAGE_ID=ghcr.io/$IMAGE_TAG | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention for main | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
docker image tag $IMAGE_TAG $IMAGE_ID:$VERSION | ||
docker image push $IMAGE_ID:$VERSION | ||
echo $IMAGE_ID:$VERSION | ||
docker container run --rm --entrypoint cat $IMAGE_TAG ipfs_hash.txt | ||
echo "::set-output name=image_id::$IMAGE_ID" | ||
echo "::set-output name=version::$VERSION" | ||
echo "::set-output name=ipfs_hash::`docker container run --rm --entrypoint cat $IMAGE_TAG ipfs_hash.txt`" | ||
release: | ||
needs: push | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.tag.outputs.new_tag }} | ||
release_name: Release ${{ needs.tag.outputs.new_tag }} | ||
tag_name: ${{ needs.push.outputs.version }} | ||
release_name: Release ${{ needs.push.outputs.version }} | ||
body: | | ||
IPFS hash of the deployment: | ||
- CIDv0: `${{ steps.pinata.outputs.hash }}` | ||
- CIDv1: `${{ steps.convert-cidv0.outputs.cidv1 }}` | ||
The latest release is always accessible via our alias to the Cloudflare IPFS gateway at [app.uniswap.org](https://app.uniswap.org). | ||
- CIDv1: `${{ needs.push.outputs.ipfs_hash }}` | ||
You can also access the Uniswap Interface directly from an IPFS gateway. | ||
**BEWARE**: The Uniswap interface uses [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to remember your settings, such as which tokens you have imported. | ||
**You should always use an IPFS gateway that enforces origin separation**, or our alias to the latest release at [app.uniswap.org](https://app.uniswap.org). | ||
**You should always use an IPFS gateway that enforces origin separation**, or our alias to the latest release at [app.uniswap.eth](ipfs://app.uniswap.eth). | ||
Your Uniswap settings are never remembered across different URLs. | ||
IPFS gateways: | ||
- https://${{ steps.convert-cidv0.outputs.cidv1 }}.ipfs.dweb.link/ | ||
- https://${{ steps.convert-cidv0.outputs.cidv1 }}.ipfs.cf-ipfs.com/ | ||
- [ipfs://${{ steps.upload.outputs.hash }}/](ipfs://${{ steps.pinata.outputs.hash }}/) | ||
${{ needs.tag.outputs.changelog }} | ||
- [ipfs://${{ needs.push.outputs.ipfs_hash }}/](ipfs://${{ needs.push.outputs.ipfs_hash }}/) | ||
- http://${{ needs.push.outputs.ipfs_hash }}.ipfs.localhost:8080/ | ||
- https://${{ needs.push.outputs.ipfs_hash }}.ipfs.dweb.link/ | ||
- https://${{ needs.push.outputs.ipfs_hash }}.ipfs.cf-ipfs.com/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# FROM node:14.20.0-bullseye-slim | ||
FROM node@sha256:bc3ba9f44ea24daa94dfecb8e3aec9ea58229e5cb6610b7739162a07f5995ee7 | ||
|
||
# install wget, git and necessary certificates so we can install IPFS below | ||
RUN apt update && apt install --yes --no-install-recommends wget git apt-transport-https ca-certificates && rm -rf /var/lib/apt/lists/* | ||
|
||
# install IPFS | ||
WORKDIR /home/root | ||
RUN wget -qO - https://dist.ipfs.tech/kubo/v0.14.0/kubo_v0.14.0_linux-amd64.tar.gz | tar -xvzf - \ | ||
&& cd kubo \ | ||
&& ./install.sh \ | ||
&& cd .. \ | ||
&& rm -rf kubo | ||
RUN ipfs init | ||
|
||
# copy package.json and yarn install first so we can cache this layer (speeds up iteration significantly) | ||
WORKDIR /app | ||
COPY package.json /app/package.json | ||
COPY yarn.lock /app/yarn.lock | ||
RUN yarn install --frozen-lockfile --ignore-scripts | ||
|
||
# copy the rest of the relevant source files and prepare, build, test the UI | ||
COPY src/ /app/src/ | ||
COPY public/ /app/public/ | ||
COPY .env .env.production .eslintrc.json .prettierrc .prettierignore babel-plugin-macros.config.js codegen.yml craco.config.cjs cypress.config.ts cypress.release.config.ts lingui.config.ts prei18n-extract.js relay_thegraph.config.js relay.config.js tsconfig.json /app/ | ||
RUN yarn prepare | ||
RUN yarn build | ||
RUN yarn run craco test --watchAll=false | ||
|
||
# add the build output to IPFS and write the hash to a file | ||
RUN ipfs add --cid-version 1 --quieter --only-hash --recursive ./build > ipfs_hash.txt | ||
# print the hash for good measure in case someone is looking at the build logs | ||
RUN cat ipfs_hash.txt | ||
|
||
# this entrypoint file will execute `ipfs add` of the build output to the docker host's IPFS API endpoint, so we can easily extract the IPFS build out of the docker image | ||
RUN printf '#!/bin/sh\nipfs --api /ip4/`getent ahostsv4 host.docker.internal | grep STREAM | head -n 1 | cut -d \ -f 1`/tcp/5001 add --cid-version 1 -r ./build' >> entrypoint.sh | ||
RUN chmod u+x entrypoint.sh | ||
|
||
ENTRYPOINT [ "./entrypoint.sh" ] |
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