Skip to content

Merge branch 'develop' of github.com:hop-protocol/hop into production #25

Merge branch 'develop' of github.com:hop-protocol/hop into production

Merge branch 'develop' of github.com:hop-protocol/hop into production #25

name: Publish Packages to Docker Hub
on:
push:
branches:
- develop
- production
paths:
- 'packages/hop-node/**'
- 'packages/v2-explorer-backend/**'
- 'packages/v1-hop-api/**'
- 'packages/v1-hop-explorer-backend/**'
- 'packages/v1-stats-worker/**'
env:
DOCKER_TAG: ${{ (github.ref_name == 'develop' && 'unstable') || (github.ref_name == 'production' && 'latest') }}
jobs:
publish-docker:
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ['hop-node', 'v2-explorer-backend', 'v1-hop-api', 'v1-hop-explorer-backend', 'v1-stats-worker']
steps:
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- name: Check versions
id: check-versions
uses: ./.github/actions/check-version
with:
package-name: ${{ matrix.package-name }}
- 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
if: steps.check-versions.outputs.package-version-changed == 'true' || github.ref_name != 'production'
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
file: ./packages/${{ matrix.package-name }}/Dockerfile
tags: hopprotocol/${{ matrix.package-name }}:${{ env.DOCKER_TAG }}
push: true
# status-notify:
# needs: [publish-docker]
# runs-on: ubuntu-latest
# environment: production
# strategy:
# matrix:
# secret-key: ['HOP_API', 'HOP_EXPLORER', 'STATS_WORKER']
# steps:
# - name: Notify webhook
# run: |
# WEBHOOK_URL=$(echo ${{ 'WEBOOK_URL_' + secrets[PACKAGE_NAME_UPPER] }})
# WEBHOOK_SECRET=$(echo ${{ 'WEBHOOK_SECRET' + secrets[PACKAGE_NAME_UPPER] }})
# STATUS="failed"
# if ${{ job.status == 'success' }}; then
# STATUS="success"
# fi
# curl "$WEBHOOK_URL" \
# -H "X-Secret: $WEBHOOK_SECRET" \
# -d '{"payload": {"reponame": "${{ github.repository }}", "branch": "${{ github.ref_name }}", "build_parameters": {"GITHUB_JOB": "${{ github.job }}"}, "outcome": "'$STATUS'", "build_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}' \
# -H "Content-Type: application/json" \
# -X POST