mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 12:05:18 +00:00
add ci action for build & publish to docker hub (#1435)
This commit is contained in:
parent
c46d70de46
commit
01f507fc1e
47
.github/workflows/ci-docker.yml
vendored
Normal file
47
.github/workflows/ci-docker.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Build & Publish Docker Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
dockerhub-username:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
CI_DOCKERHUB_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# runs in ci-master after successful checks
|
||||||
|
# you can use images built by this action in future jobs.
|
||||||
|
# https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
# https://github.com/marketplace/actions/build-and-push-docker-images
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# ensure working with latest code
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
# generate a git commit hash to be used as image tag
|
||||||
|
- name: Generate short hash
|
||||||
|
id: commit-hash
|
||||||
|
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
|
||||||
|
# qemu is used to emulate different platform architectures
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
# cross-platform build of the image
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
# authenticate for publish to docker hub
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ inputs.dockerhub-username }}
|
||||||
|
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
|
||||||
|
# publish to docker hub, tag with short git hash
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: kava/kava:${{ steps.commit-hash.outputs.short }},kava/kava:master
|
6
.github/workflows/ci-master.yml
vendored
6
.github/workflows/ci-master.yml
vendored
@ -39,6 +39,12 @@ jobs:
|
|||||||
AWS_REGION: us-east-1
|
AWS_REGION: us-east-1
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
|
||||||
|
docker:
|
||||||
|
# only run if all checks pass
|
||||||
|
needs: [lint-checks, default-checks]
|
||||||
|
uses: ./.github/workflows/ci-docker.yml
|
||||||
|
with:
|
||||||
|
dockerhub-username: pirtleshell
|
||||||
post-pipeline-metrics:
|
post-pipeline-metrics:
|
||||||
uses: ./.github/workflows/metric-pipeline.yml
|
uses: ./.github/workflows/metric-pipeline.yml
|
||||||
if: always() # always run so we metric failures and successes
|
if: always() # always run so we metric failures and successes
|
||||||
|
Loading…
Reference in New Issue
Block a user