-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Add publish docker for eth-rpc (#6286)
close paritytech/ci_cd#1073
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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,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 }} |