Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of minor UI improvements #68

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 33 additions & 71 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Publish Docker image
on:
push:
branches:
- "main"
- "develop"
tags:
- "*"
- "v*"

env:
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -18,7 +19,11 @@ jobs:
matrix:
platform:
- linux/amd64
- linux/arm64
permissions:
id-token: write
contents: write
packages: write

steps:
- name: Prepare
run: |
Expand All @@ -36,6 +41,22 @@ jobs:
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3

- name: "Authenticate to Google Cloud"
id: google-auth
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
workload_identity_provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}"
service_account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}"
create_credentials_file: true

- name: Login to the registry - production
uses: docker/login-action@v2
with:
registry: asia-docker.pkg.dev
username: oauth2accesstoken
password: "${{ steps.google-auth.outputs.access_token }}"

- name: Docker Login
uses: docker/login-action@v3
with:
Expand All @@ -46,89 +67,30 @@ jobs:
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Docker Metadata action
id: meta
uses: docker/metadata-action@v5
with:
images: |
otterscan/otterscan
ghcr.io/${{ env.IMAGE_NAME }}
zilliqa/otterscan
asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/otterscan
tags: |
type=ref,enable=false,priority=600,prefix=pr-,suffix=,event=pr
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{raw}}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
packages: write

steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
otterscan/otterscan
ghcr.io/${{ env.IMAGE_NAME }}

- name: Docker Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
30 changes: 0 additions & 30 deletions .github/workflows/integration-deployment.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/main-pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check main PR source branch
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-pr-source:
runs-on: ubuntu-latest
steps:
- name: Verify source branch
if: github.base_ref == 'main' && github.head_ref != 'develop'
run: |
echo "Error: Pull request source branch is not 'develop'."
exit 1
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Vite cache
.vite/

# emacs backups
*~
\.#*
\#*

# dependencies
/node_modules
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ scripts
chains
topic0
trustwallet

node_modules
.github
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN npm run build

# Add brotli module to official nginx image
# Based on: https://github.com/nginxinc/docker-nginx/tree/master/modules
FROM nginx:1.21.3-alpine as nginxbuilder
FROM nginx:1.27.0-alpine3.19 as nginxbuilder

RUN set -ex \
&& apk update \
Expand Down Expand Up @@ -61,7 +61,7 @@ RUN set -ex \
done \
&& echo "BUILT_MODULES=\"$BUILT_MODULES\"" > /tmp/packages/modules.env

FROM nginx:1.21.3-alpine
FROM nginx:1.27.0-alpine3.19
COPY --from=nginxbuilder /tmp/packages /tmp/packages
RUN set -ex \
&& . /tmp/packages/modules.env \
Expand Down
26 changes: 26 additions & 0 deletions README.zilliqa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Zilliqa Otterscan

Here are some local notes for the Zilliqa version of otterscan

## Autogenerated files

There are some modules (`autogen/version.ts` in particular) which are
autogenerated. Because there is no way to stop Vite from trying to
analyse these, they must always be there.

Because there is no way to tell git to remember their existence but
ignore changes to them, they are generated by `npm start` as well as
`npm build`, but they are not checked into the repo.

Be warned! If you use `vite` directly, you may end up with analysis
errors due to their absence.

## Starting for development

.. because I keep forgetting!

```
export VITE_ERIGON_URL=<url>
npm run assets-start
npm start
```
2 changes: 2 additions & 0 deletions autogen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.ts

Empty file added autogen/.gitkeep
Empty file.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Erigon based block explorer" />
<meta name="description" content="Zilliqa block explorer" />
<meta name="format-detection" content="telephone=no" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Montserrat"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
Loading