Skip to content

Commit

Permalink
[ci] Add publish docker for eth-rpc (#6286)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvicsam authored Oct 30, 2024
1 parent 06debd0 commit 6f96f72
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-publish-eth-rpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and push ETH-RPC image

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
IMAGE_NAME: "docker.io/paritypr/eth-rpc"

jobs:
set-variables:
# This workaround sets the container image for each job using 'set-variables' job output.
# env variables don't work for PR from forks, so we need to use outputs.
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
- name: Define version
id: version
run: |
export COMMIT_SHA=${{ github.sha }}
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8}
export REF_NAME=${{ github.ref_name }}
export REF_SLUG=${REF_NAME//\//_}
VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT
echo "set VERSION=${VERSION}"
build_docker:
name: Build docker image
runs-on: parity-large
needs: [set-variables]
env:
VERSION: ${{ needs.set-variables.outputs.VERSION }}
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./substrate/frame/revive/rpc/Dockerfile
push: false
tags: |
${{ env.IMAGE_NAME }}:${{ env.VERSION }}
build_push_docker:
name: Build and push docker image
runs-on: parity-large
if: github.ref == 'refs/heads/master'
needs: [set-variables]
env:
VERSION: ${{ needs.set-variables.outputs.VERSION }}
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./substrate/frame/revive/rpc/Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.VERSION }}

0 comments on commit 6f96f72

Please sign in to comment.