Build and Publish container #64
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 Publish container | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish to ghcr?' | |
required: false | |
default: 'false' | |
specific-version: | |
description: 'Publish tag with specific version? (from .env)' | |
required: true | |
default: 'true' | |
latest-version: | |
description: 'Publish tag "latest"?' | |
required: true | |
default: 'false' | |
jobs: | |
ghcr_push: | |
runs-on: ubuntu-latest | |
if: github.event.inputs.publish == 'true' | |
steps: | |
- name: checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set variables | |
env: | |
IMAGE_ID_BASE: ghcr.io/axlabs/neo3-privatenet-docker/neo-cli | |
IMAGE_ID_PLUGINS: ghcr.io/axlabs/neo3-privatenet-docker/neo-cli-with-plugins | |
VERSION_LATEST: latest | |
run: | | |
set -o allexport; source .env; set +o allexport | |
echo "IMAGE_ID_BASE=${IMAGE_ID_BASE}" >> $GITHUB_ENV | |
echo "IMAGE_ID_PLUGINS=${IMAGE_ID_PLUGINS}" >> $GITHUB_ENV | |
echo "VERSION_LATEST=${VERSION_LATEST}" >> $GITHUB_ENV | |
echo "VERSION_SPECIFIC=${IMAGE_TAG}" >> $GITHUB_ENV | |
- name: Build and push base image (neo-node) ('latest' tag) | |
if: github.event.inputs.latest-version == 'true' | |
run: | | |
echo IMAGE_ID_BASE=$IMAGE_ID_BASE | |
echo VERSION_LATEST=$VERSION_LATEST | |
docker buildx build \ | |
--no-cache \ | |
--push \ | |
--tag $IMAGE_ID_BASE:$VERSION_LATEST \ | |
--platform linux/amd64,linux/arm64 \ | |
./neo-node | |
- name: Build and push base image (neo-node) (specific version tag) | |
if: github.event.inputs.specific-version == 'true' | |
run: | | |
echo IMAGE_ID_BASE=$IMAGE_ID_BASE | |
echo VERSION_SPECIFIC=$VERSION_SPECIFIC | |
docker buildx build \ | |
--no-cache \ | |
--push \ | |
--tag $IMAGE_ID_BASE:$VERSION_SPECIFIC \ | |
--platform linux/amd64,linux/arm64 \ | |
./neo-node | |
- name: Build and push neo-cli-with-plugins ('latest' tag) | |
if: github.event.inputs.latest-version == 'true' | |
run: | | |
echo IMAGE_ID_PLUGINS=$IMAGE_ID_PLUGINS | |
echo VERSION_LATEST=$VERSION_LATEST | |
docker buildx build \ | |
--no-cache \ | |
--push \ | |
--tag $IMAGE_ID_PLUGINS:$VERSION_LATEST \ | |
--platform linux/amd64,linux/arm64 \ | |
-f ./docker/Dockerfile \ | |
--target NeoCliFinal \ | |
--build-arg IMAGE_TAG=$VERSION_LATEST \ | |
./neo-modules | |
- name: Build and push neo-cli-with-plugins (specific version tag) | |
if: github.event.inputs.specific-version == 'true' | |
run: | | |
echo IMAGE_ID_PLUGINS=$IMAGE_ID_PLUGINS | |
echo VERSION_SPECIFIC=$VERSION_SPECIFIC | |
docker buildx build \ | |
--no-cache \ | |
--push \ | |
--tag $IMAGE_ID_PLUGINS:$VERSION_SPECIFIC \ | |
--platform linux/amd64,linux/arm64 \ | |
-f ./docker/Dockerfile \ | |
--target NeoCliFinal \ | |
--build-arg IMAGE_TAG=$VERSION_SPECIFIC \ | |
./neo-modules |