Merge branch 'staging' of github.com:hop-protocol/hop into production #94
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
name: Publish Packages to Docker Hub | |
on: | |
push: | |
branches: | |
- staging | |
- production | |
paths: | |
- 'packages/hop-node/**' | |
- 'packages/v2-explorer-backend/**' | |
- 'packages/api/**' | |
- 'packages/explorer-backend/**' | |
- 'packages/stats-worker/**' | |
env: | |
DOCKER_TAG: ${{ (github.ref_name == 'production' && 'latest') || 'unstable' }} | |
jobs: | |
publishable-packages: | |
name: Check for package that can be published | |
uses: ./.github/workflows/publishable-packages.yml | |
with: | |
package-names: 'hop-node:v2-explorer-backend:api:explorer-backend:stats-worker' | |
publish-docker: | |
name: Publish Docker | |
needs: publishable-packages | |
if: ${{ fromJson(needs.publishable-packages.outputs.publishable-packages)[0] != '' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package-name: ${{ fromJson(needs.publishable-packages.outputs.publishable-packages) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b | |
- 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: Set Docker Tags | |
id: set-docker-tag | |
run: | | |
# Modify any discrepancies in the package name vs the image name | |
if [ "${{ matrix.package-name }}" == "api" ]; then | |
echo "IMAGE_NAME=hopprotocol/hop-api" >> $GITHUB_OUTPUT | |
else | |
echo "IMAGE_NAME=hopprotocol/${{ matrix.package-name }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish Docker Image (${{ env.DOCKER_TAG }}) | |
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 | |
with: | |
context: . | |
file: ./packages/${{ matrix.package-name }}/Dockerfile | |
tags: ${{ steps.set-docker-tag.outputs.IMAGE_NAME }}:${{ env.DOCKER_TAG }} | |
push: true |