Skip to content

Commit

Permalink
Merge pull request #2 from HugoBroudeur/aylin
Browse files Browse the repository at this point in the history
Aylin
  • Loading branch information
HugoBroudeur committed Mar 13, 2024
2 parents 9eb8ed5 + 42798ad commit 903d3de
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 15 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/cd-oonodz-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build + Push ooNodz image

on:
workflow_run:
workflows: ["Release"]
types:
- completed

defaults:
run:
shell: bash

jobs:
build_oonodz_mainnet_image:
name: Build Docker Image
timeout-minutes: 60
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4

- name: Login to Docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASS }}

- name: Create the Dockerfile
run: |
multiline_text=$(cat <<EOF
ARG AVALANCHE_VERSION
FROM avaplatform/avalanchego:\${AVALANCHE_VERSION} as builder
ARG HUBBLENET_RELEASE_TAG
RUN if [ "\${HUBBLENET_RELEASE_TAG:0:1}" = "v" ]; then \
HUBBLENET_VERSION="\${HUBBLENET_RELEASE_TAG:1}"; \
export HUBBLENET_RELEASE_TAG="\${HUBBLENET_RELEASE_TAG}"; \
else \
export HUBBLENET_VERSION="\${HUBBLENET_RELEASE_TAG}"; \
fi
RUN apt update \
&& DEBIAN_FRONTEND="noninteractive" apt install -y wget \
&& cd /tmp \
&& wget https://github.com/hubble-exchange/hubblenet/releases/download/\${HUBBLENET_RELEASE_TAG}/hubblenet_\${HUBBLENET_VERSION}_linux_amd64.tar.gz \
&& tar xf hubblenet_\${HUBBLENET_VERSION}_linux_amd64.tar.gz
FROM avaplatform/avalanchego:\${AVALANCHE_VERSION}
LABEL Description="Hubblenet image"
ARG HUBBLENET_RELEASE_TAG
RUN mkdir -p /root/.avalanchego/plugins \
&& DEBIAN_FRONTEND="noninteractive" apt update \
&& DEBIAN_FRONTEND="noninteractive" apt install -y wget
RUN if [ "\${HUBBLENET_RELEASE_TAG:0:1}" = "v" ]; then \
HUBBLENET_VERSION="\${HUBBLENET_RELEASE_TAG:1}"; \
export HUBBLENET_RELEASE_TAG="\${HUBBLENET_RELEASE_TAG}"; \
else \
export HUBBLENET_VERSION="\${HUBBLENET_RELEASE_TAG}"; \
fi
EOF
)
if [ "$AVALANCHE_ENVIRONMENT" = "mainnet" ]; then
multiline_text+="\nCOPY --from=builder /tmp/hubblenet-\${HUBBLENET_VERSION} /root/.avalanchego/plugins/o1Fg94YujMqL75Ebrdkos95MTVjZpPpdeAp5ocEsp2X9c2FSz"
fi
if [ "$AVALANCHE_ENVIRONMENT" = "testnet" ]; then
multiline_text+="\nCOPY --from=builder /tmp/hubblenet-\${HUBBLENET_VERSION} /root/.avalanchego/plugins/jvrKsTB9MfYGnAXtxbzFYpXKceXr9J8J8ej6uWGrYM5tXswhJ"
fi
echo "$multiline_text" > Dockerfile-release
- name: Build and push release image for the mainnet
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-release
push: true
tags: "logisticx/ava:${{ vars.AVALANCHE_VERSION }}-${{ github.ref_name }}"
env:
HUBBLENET_RELEASE_TAG: "${{github.ref_name}}"
AVALANCHE_VERSION: "${{ vars.AVALANCHE_VERSION }}"
AVALANCHE_ENVIRONMENT: mainnet

- name: Build and push release image for the fuji
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-release
push: true
tags: "logisticx/ava:${{ vars.AVALANCHE_VERSION }}-fuji-${{ github.ref_name }}"
env:
HUBBLENET_RELEASE_TAG: "${{github.ref_name}}"
AVALANCHE_VERSION: "${{ vars.AVALANCHE_VERSION }}"
AVALANCHE_ENVIRONMENT: testnet
18 changes: 5 additions & 13 deletions .github/workflows/ci-oonodz-aylin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Build + Push ooNodz image
name: Build and Push aylin image

on:
push:
branches:
- aylin
- main
tags:
- "*"

defaults:
run:
Expand All @@ -32,21 +29,16 @@ jobs:

- name: Build Dockerfile and Push it
run: |
TAG_FUJI=""
TAG_FUJI="fuji-"
TAG_END=$GITHUB_SHA
if [ "$CURRENT_BRANCH" == "aylin" ]; then
TAG_FUJI="fuji-"
echo "COPY --from=builder /build/jvrKsTB9MfYGnAXtxbzFYpXKceXr9J8J8ej6uWGrYM5tXswhJ /root/.avalanchego/plugins/jvrKsTB9MfYGnAXtxbzFYpXKceXr9J8J8ej6uWGrYM5tXswhJ" >> Dockerfile
fi
if [ -n "$GITHUB_TAG" ]; then
TAG_END=$GITHUB_TAG
else
TAG_END=$GITHUB_SHA
fi
export BUILD_IMAGE_ID="${{ vars.AVALANCHE_VERSION }}-${TAG_FUJI}${TAG_END}"
export BUILD_IMAGE_ID="${{ vars.AVALANCHE_VERSION_DEV }}-${TAG_FUJI}${TAG_END}"
echo "COPY --from=builder /build/jvrKsTB9MfYGnAXtxbzFYpXKceXr9J8J8ej6uWGrYM5tXswhJ /root/.avalanchego/plugins/jvrKsTB9MfYGnAXtxbzFYpXKceXr9J8J8ej6uWGrYM5tXswhJ" >> Dockerfile
./scripts/build_image.sh
env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL or empty if its private hosted.
github:
owner: hubble-exchange
name: hubblenet
owner: HugoBroudeur
name: test-stuff

0 comments on commit 903d3de

Please sign in to comment.