-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' of github.com:hop-protocol/hop into production
- Loading branch information
Showing
23 changed files
with
206 additions
and
144 deletions.
There are no files selected for viewing
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
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
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,76 @@ | ||
# A publishable package is a package that has been modified and, if the | ||
# if the branch is production, has a new version. | ||
|
||
name: Get packages that should be published | ||
on: | ||
workflow_call: | ||
inputs: | ||
package-names: | ||
description: 'Package names to consider, separated by commas.' | ||
required: true | ||
type: string | ||
outputs: | ||
publishable-packages: | ||
description: 'Returns the name of all packages that should be published.' | ||
value: ${{ jobs.publishable-packages.outputs.publishable-packages }} | ||
|
||
jobs: | ||
publishable-packages: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
publishable-packages: ${{ steps.publishable-packages.outputs.modified_packages }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b | ||
|
||
- name: Get modified dirs | ||
id: modified-dirs | ||
uses: tj-actions/changed-files@a29e8b565651ce417abb5db7164b4a2ad8b6155c | ||
with: | ||
since_last_remote_commit: true | ||
dir_names: true | ||
dir_names_max_depth: 2 | ||
separator: ',' | ||
files: ${{ github.event.inputs.paths }} | ||
|
||
- name: Get publishable packages | ||
id: publishable-packages | ||
run: | | ||
# Extract changed directories from output, removing the 'package/' prefix | ||
# Example: packages/hop-node,packages/v2-explorer-backend,packages/frontend | ||
modified_dirs="${{ steps.modified-dirs.outputs.all_changed_files }}" | ||
# Read input package names, compare with modified directories | ||
# Example: packages/hop-node,packages/v2-explorer-backend | ||
IFS=":" | ||
read -a input_packages <<< "${{ inputs.package-names }}" | ||
modified_packages="" | ||
|
||
for package in "${input_packages[@]}"; do | ||
package_path="packages/$package" | ||
|
||
# Skip packages not modified | ||
if [[ $modified_dirs != *"$package_path"* ]]; then | ||
continue | ||
fi | ||
|
||
# On the production branch, publish only if there's a version change | ||
if [ "${{ github.head_ref }}" == "production" ]; then | ||
version_changed=$(git diff HEAD^ HEAD -- "${package_path}/package.json" | grep '"version":' || true) | ||
if [ "$version_changed" ]; then | ||
continue | ||
fi | ||
fi | ||
|
||
modified_packages+="$package," | ||
done | ||
|
||
# Strip the trailing comma | ||
# Example: packages/hop-node,packages/v2-explorer-backend | ||
modified_packages="${modified_packages%,}" | ||
|
||
# Convert from string with commas to array for consumption by matrix | ||
# Example: ["hop-node", "v2-explorer-backend"] | ||
modified_packages=$(echo $modified_packages | tr ',' '\n' | sed 's/^ *//;s/ *$//' | jq -R -s -c 'split("\n")[:-1]') | ||
|
||
echo "modified_packages=$modified_packages" >> $GITHUB_OUTPUT |
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,3 @@ | ||
# Ops | ||
|
||
Various operational packages |
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,17 @@ | ||
# Webhooks | ||
|
||
Set up a webhook to auto-restart Docker processes on a server. The default script looks for the successful completion of a GitHub workflow that publishes a new Docker image with the `latest` tag. | ||
|
||
# Instructions | ||
|
||
### On GitHub | ||
|
||
Set up a webhook [on GitHub](https://github.com/hop-protocol/hop/settings/hooks) to send a request to a webhook server. | ||
|
||
### On the server | ||
|
||
Ensure port `4665` can accept incoming requests. | ||
|
||
- Set the `DOCKER_IMAGE_NAME` and `WEBHOOK_SECRET` envs in `~/.bashrc` and source it. | ||
- Add the scripts in this repo to the server. | ||
- Run the webhook server in the background with `./run_webhook_server.sh &` |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rer-backend/scripts/run_webhook_server.sh → ops/webhooks/run_webhook_server.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
|
||
/usr/local/bin/gws -port=4665 -method=POST -path=/postreceive -secret=$WEBHOOK_SECRET -command=$(pwd)/circleci_webhook_postreceive.sh | ||
/usr/local/bin/gws -port=4665 -method=POST -path=/postreceive -secret=$WEBHOOK_SECRET -command=$(pwd)/webhook_postreceive.sh |
File renamed without changes.
Oops, something went wrong.