Build and Release Lido Exporter Docker Image #10
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: Build and Release Lido Exporter Docker Image | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release (e.g., lido-exporter-v1.2.3)' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Create and Push Docker Image | |
runs-on: ubuntu-latest | |
env: | |
TAG: ${{ github.event.inputs.tag }} | |
steps: | |
- name: Extract version | |
id: extract_version | |
shell: bash | |
run: | | |
VERSION=${TAG#lido-exporter-} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./cmd/lido-exporter/Dockerfile | |
push: true | |
tags: | | |
nethermindeth/lido-exporter:${{ env.VERSION }} | |
nethermindeth/lido-exporter:latest | |
- name: Log out of Docker Hub | |
run: docker logout | |
create-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
TAG: ${{ github.event.inputs.tag }} | |
steps: | |
- name: Extract version | |
id: extract_version | |
shell: bash | |
run: | | |
VERSION=${TAG#lido-exporter-} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.VERSION }} | |
draft: true | |
prerelease: false | |
generateReleaseNotes: true |