Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:hop-protocol/hop into production
Browse files Browse the repository at this point in the history
  • Loading branch information
shanefontaine committed May 14, 2024
2 parents 5092506 + d43d97a commit b86614a
Show file tree
Hide file tree
Showing 141 changed files with 13,241 additions and 10,965 deletions.
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @DEV: The cache hangs when using PNPM on certain local environments. Comment it out
# when running locally. You only lose the cacheing of pnpm install.
# https://github.com/actions/setup-node/issues/824

name: Setup
description: Common setup steps used by our workflows
runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
with:
version: 9
run_install: false

- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org
# cache: 'pnpm'
56 changes: 56 additions & 0 deletions .github/workflows/check-modified.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Checks the status of the local package.json and packages
on:
workflow_call:
inputs:
package-name:
type: string
description: Name of the package
outputs:
npm-version-changed:
description: 'Returns a boolean indicating if there is an NPM version mismatch between the local package.json and the NPM registry.'
value: ${{ jobs.check.outputs.npm-version-changed }}
modified-packages:
description: 'Returns a list of all packages (i.e. `packages/sdk`) that have been modified in any way.'
value: ${{ jobs.check.outputs.modified-packages }}
is-package-modified:
description: 'Returns a boolean indicating if the passed-in package was changed in any way.'
value: ${{ jobs.check.outputs.is-package-modified }}

jobs:
check:
runs-on: ubuntu-latest
outputs:
npm-version-changed: ${{ steps.check-npm.outputs.npm-version-changed }}
modified-packages: ${{ steps. modified-packages.outputs.all_changed_files }}
is-package-modified: ${{ steps.did-change.outputs.is-package-modified }}
steps:
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b

- name: Get local and current versions
id: check-npm
working-directory: ./packages/sdk
run: |
CURRENT_VERSION=$(npm info . --json | jq -r '."dist-tags".latest')
LOCAL_VERSION=$(jq -r '.version' package.json)
if [[ "$CURRENT_VERSION" != "$LOCAL_VERSION" ]]; then
echo "npm-version-changed=true" >> $GITHUB_OUTPUT
else
echo "npm-version-changed=false" >> $GITHUB_OUTPUT
fi
- name: Get modified packages
id: modified-packages
uses: tj-actions/changed-files@a29e8b565651ce417abb5db7164b4a2ad8b6155c
with:
dir_names: 'true'
dir_names_max_depth: 2

- name: Check if passed in package changed
id: did-change
run: |
if [[ "${{ steps.modified-packages.outputs.all_changed_files }}" == *"packages/${{ inputs.package-name }}"* ]]; then
echo "is-package-modified=true" >> $GITHUB_OUTPUT
else
echo "is-package-modified=false" >> $GITHUB_OUTPUT
fi
35 changes: 6 additions & 29 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
name: Simple Github Action for Debugging Builds
name: Publish Packages to NPM if Necessary
on:
push:
branches:
- develop
- TODO
env:
BRANCH_NAME: ${{ github.ref_name }}

jobs:
build:
if: false
name: Build
debug:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 20
registry-url: https://registry.npmjs.org

- name: Install node dependencies
run: |
npm install -g [email protected] [email protected] # required to build @eth-optimism packages
pnpm install
- name: Build the frontend app
env:
PUBLIC_URL: .
REACT_APP_NETWORK: goerli
REACT_APP_IPFS_BUILD: true
run: NODE_OPTIONS=--openssl-legacy-provider pnpm build

- run: echo 'Debug'
67 changes: 67 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish Packages to Docker Hub if Necessary
on:
push:
branches:
- develop
- production
paths:
- 'packages/hop-node/**'
- 'packages/v2-explorer-backend/**'

env:
DOCKER_TAG: ${{ (github.ref_name == 'develop' && 'unstable') || (github.ref_name == 'production' && 'latest') }}

# TODO: DRY

jobs:
check-modified-hop-node:
uses: ./.github/workflows/check-modified.yml
with:
package-name: hop-node

check-modified-v2-explorer-backend:
uses: ./.github/workflows/check-modified.yml
with:
package-name: v2-explorer-backend

publish-docker-hop-node:
needs: check-modified-hop-node
if: needs.check-modified-hop-node.outputs.npm-version-changed == 'true' || github.ref_name != 'production'
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb

- name: Login to Docker Hub
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish Docker image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
file: ./packages/hop-node/Dockerfile
tags: hopprotocol/hop-node:${{ env.DOCKER_TAG }}
push: true

publish-docker-v2-explorer-backend:
needs: check-modified-v2-explorer-backend
if: needs.check-modified-check-modified-v2-explorer-backend.outputs.npm-version-changed == 'true' || github.ref_name != 'production'
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb

- name: Login to Docker Hub
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish Docker image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
file: ./packages/v2-explorer-backend/Dockerfile
tags: hopprotocol/v2-explorer-backend:${{ env.DOCKER_TAG }}
push: true
197 changes: 0 additions & 197 deletions .github/workflows/frontend.yml

This file was deleted.

Loading

0 comments on commit b86614a

Please sign in to comment.