Publish Docker (Legacy PureStake) #2
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 (Legacy PureStake) | |
on: | |
workflow_dispatch: | |
inputs: | |
client_tag: | |
description: moonbeam client tag (ex. v0.8.3) to publish on docker | |
required: true | |
overrides_branch: | |
description: runtime overrides branch (default master) | |
required: true | |
default: "master" | |
jobs: | |
docker-moonbeam-tracing: | |
runs-on: ubuntu-latest | |
outputs: | |
sha: ${{ steps.get-sha.outputs.sha }} | |
sha4: ${{ steps.get-sha.outputs.sha4 }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.overrides_branch }} | |
- name: Get Sha | |
id: get-sha | |
run: | | |
echo ::set-output name=sha::$(git log -1 --format="%H") | |
echo ::set-output name=sha4::$(git log -1 --format="%H" | cut -c1-4) | |
- name: Get last tracing runtime spec version | |
id: get-last-spec-version | |
run: | | |
INTEGER_REGEX='^[0-9]+$' | |
MAX=0 | |
cd tracing | |
for D in *; do | |
if [[ "${D}" =~ $INTEGER_REGEX ]] ; then | |
if [ "${D}" -gt "$MAX" ]; then | |
MAX=${D} | |
fi | |
fi | |
done | |
echo ::set-output name=last_spec_version::$MAX | |
echo "last_spec_version: $MAX" | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=purestake/moonbeam-tracing | |
DOCKER_TAG="${DOCKER_IMAGE}:${{ github.event.inputs.client_tag }}-${{ steps.get-last-spec-version.outputs.last_spec_version }}-${{ steps.get-sha.outputs.sha4 }}" | |
DOCKER_LATEST_TAG="${DOCKER_IMAGE}:${{ github.event.inputs.client_tag }}-${{ steps.get-last-spec-version.outputs.last_spec_version }}-latest" | |
echo ::set-output name=docker_tag::${DOCKER_TAG} | |
echo ::set-output name=docker_latest_tag::${DOCKER_LATEST_TAG} | |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Check existing docker image | |
id: check-docker-image | |
run: | | |
echo ::set-output name=image_exists::$(docker manifest inspect ${{ steps.prep.outputs.docker_tag }} > /dev/null && echo "true" || echo "false") | |
- name: Display variables | |
run: | | |
echo git_ref: ${{ github.event.inputs.overrides_branch }} | |
echo sha: ${{ steps.get-sha.outputs.sha }} | |
echo sha4: ${{ steps.get-sha.outputs.sha4 }} | |
echo image_tag: ${{ steps.prep.outputs.docker_tag }} | |
echo image_exists: ${{ steps.check-docker-image.outputs.image_exists }} | |
- name: Retrieve moonbeam client | |
run: | | |
mkdir build | |
CLIENT_TAG=${{ github.event.inputs.client_tag }} | |
CLIENT_IMAGE="purestake/moonbeam:$CLIENT_TAG" | |
docker create -ti --name dummy $CLIENT_IMAGE bash | |
docker cp dummy:/moonbeam/moonbeam build/moonbeam | |
docker rm -f dummy | |
- name: Add moonbase runtimes overrides | |
run: | | |
mkdir -p build/moonbase-substitutes-tracing | |
cp wasm/moonbase-* build/moonbase-substitutes-tracing/ | |
- name: Add moonriver runtimes overrides | |
run: | | |
mkdir -p build/moonriver-substitutes-tracing | |
cp wasm/moonriver-* build/moonriver-substitutes-tracing/ | |
- name: Add moonbeam runtimes overrides | |
run: | | |
mkdir -p build/moonbeam-substitutes-tracing | |
cp wasm/moonbeam-* build/moonbeam-substitutes-tracing/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
driver-opts: | | |
image=moby/buildkit:master | |
- name: Login to DockerHub (LEGACY PureStake) | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push moonbeam-tracing | |
id: docker_build | |
if: ${{ steps.check-docker-image.outputs.image_exists }} == false | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/moonbeam-tracing.Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
${{ steps.prep.outputs.docker_tag }} | |
${{ steps.prep.outputs.docker_latest_tag }} | |
labels: | | |
org.opencontainers.image.title="Moonbeam Tracing" | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} |