Publish Docker images #3
Workflow file for this run
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 Docker images | |
on: | |
push: | |
tags: | |
# Regex for a version number such as 0.1.0 | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
docker_publish: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_ORGANIZATION_NAME: maksimryndin | |
DOCKER_REPOSITORY_NAME: starknet-stone | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get the release version from the tag | |
shell: bash | |
run: | | |
set +e | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Check if specified version is already pushed | |
run: | | |
EXISTS=$(docker manifest inspect $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ env.VERSION }} > /dev/null; echo $?) | |
echo $EXISTS | |
if [[ ${EXISTS} -eq 0 ]]; then | |
echo 'The specified version has been already released to DockerHub.' | |
fi | |
- name: Build & push docker images | |
run: | | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64 \ | |
--tag $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ env.VERSION }} \ | |
--tag $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:latest \ | |
--file prover/Dockerfile \ | |
--push . |