Skip to content

Commit

Permalink
chore: Introduced version file
Browse files Browse the repository at this point in the history
  • Loading branch information
satran004 committed Apr 24, 2024
1 parent 4d6e8a7 commit 679146c
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 61 deletions.
64 changes: 16 additions & 48 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,20 @@ jobs:
- uses: actions/checkout@v4
- name: Docker Login
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
- name: 'Get Tag from version file
run: |
TAG=$(grep "tag=" version | cut -d'=' -f2)
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Run build
run: earthly --push +build-all-platforms


# - uses: actions/checkout@v2
# - name: Set up JDK 21
# uses: actions/setup-java@v2
# with:
# java-version: 21
# distribution: 'liberica'
# - name: Decode GPG Key
# run: |
# mkdir -p ~/.gradle/
# echo "${{secrets.SIGNING_KEY}}" > ~/.gradle/secring.gpg.b64
# base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew clean build -Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) --warn --stacktrace
# - name: 'Get Version Number'
# run: |
# ARTIFACT_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
# echo "VERSION=${ARTIFACT_VERSION}" >> $GITHUB_ENV
# - name: Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: |
# build/libs/yaci*-${{env.VERSION}}.jar
# prerelease: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push
# uses: docker/build-push-action@v4
# with:
# context: .
# platforms: linux/amd64,linux/arm64
# push: true
# build-args: APP_VERSION=${{env.VERSION}}
# tags: bloxbean/yaci-cli:latest,bloxbean/yaci-cli:${{ env.VERSION }}
run: earthly --push +build-all-platforms --tag ${{ env.TAG }}
- name: Docker Push
run: docker push bloxbean/yaci-devkit:${{ env.TAG }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/yaci-devkit-${{env.VERSION}}.zip
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 46 additions & 6 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,68 @@
VERSION 0.8

ARG --global ALL_BUILD_TARGETS="cli viewer"
ARG --global ALL_BUILD_TARGETS="devkit viewer"
ARG --global DOCKER_IMAGE_PREFIX="yaci"
ARG --global TAG="0.0.1-preview"
ARG --global tag="dev"

build:
LOCALLY
FOR image_target IN $ALL_BUILD_TARGETS
BUILD +$image_target
END
BUILD +zip

build-all-platforms:
LOCALLY
FOR image_target IN $ALL_BUILD_TARGETS
BUILD --platform=linux/amd64 --platform=linux/arm64 +$image_target
END
BUILD +zip

cli:
devkit:
ARG EARTHLY_TARGET_NAME
ARG EARTHLY_GIT_SHORT_HASH
FROM DOCKERFILE --build-arg APP_VERSION=${TAG} --build-arg COMMIT_ID=${EARTHLY_GIT_SHORT_HASH} applications/${EARTHLY_TARGET_NAME}/.
SAVE IMAGE bloxbean/${DOCKER_IMAGE_PREFIX}-devkit:${TAG}
FROM DOCKERFILE --build-arg APP_VERSION=${tag} --build-arg COMMIT_ID=${EARTHLY_GIT_SHORT_HASH} applications/cli/.
SAVE IMAGE ${DOCKER_IMAGE_PREFIX}-${EARTHLY_TARGET_NAME}:${tag}

viewer:
ARG EARTHLY_TARGET_NAME
FROM DOCKERFILE applications/${EARTHLY_TARGET_NAME}/.
SAVE IMAGE bloxbean/${DOCKER_IMAGE_PREFIX}-${EARTHLY_TARGET_NAME}:${TAG}
SAVE IMAGE ${DOCKER_IMAGE_PREFIX}-${EARTHLY_TARGET_NAME}:${tag}
zip:
LOCALLY
RUN rm -rf build
FROM alpine:3.19.1
WORKDIR /app
ARG EARTHLY_TARGET_NAME
ARG EARTHLY_GIT_SHORT_HASH
RUN apk add --no-cache zip
RUN mkdir -p /app/yaci-devkit-${tag}
RUN echo > /app/yaci-devkit-${tag}/version
RUN echo "tag=${tag}" >> /app/yaci-devkit-${tag}/version
RUN echo "revision=${EARTHLY_GIT_SHORT_HASH}" >> /app/yaci-devkit-${tag}/version
COPY docker-compose.yml \
env \
ssh.sh \
start.sh \
stop.sh \
yaci-cli.sh \
cardano-cli.sh \
info.sh \
LICENSE \
README.md \
/app/yaci-devkit-${tag}/

RUN cd /app && zip -r yaci-devkit-${tag}.zip .
SAVE ARTIFACT yaci-devkit-${tag}.zip AS LOCAL build/yaci-devkit-${tag}.zip

docker-publish:
WAIT
BUILD +build-all-platforms
END
LOCALLY
LET IMAGE_NAME = ""
FOR image_target IN $ALL_BUILD_TARGETS
SET IMAGE_NAME = ${DOCKER_IMAGE_PREFIX}-${image_target}
RUN docker tag ${IMAGE_NAME}:${tag} bloxbean/${IMAGE_NAME}:${tag}
RUN docker push bloxbean/${IMAGE_NAME}:${tag}
END
2 changes: 1 addition & 1 deletion cardano-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ then
CMD="docker compose"
fi

$CMD --env-file env exec yaci-cli cardano-cli $* --testnet-magic 42
$CMD --env-file env --env-file version exec yaci-cli cardano-cli $* --testnet-magic 42
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
yaci-cli:
image: bloxbean/yaci-cli:0.0.20-beta1
image: bloxbean/yaci-devkit:${tag}
ports:
- "${HOST_N2N_PORT}:3001"
- "${HOST_N2C_SOCAT_PORT}:3333"
Expand All @@ -19,7 +19,7 @@ services:
- infinity

yaci-viewer:
image: bloxbean/yaci-viewer:0.0.9
image: bloxbean/yaci-devkit:${tag}
ports:
- "${HOST_VIEWER_PORT}:5173"
env_file:
Expand Down
2 changes: 1 addition & 1 deletion ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ then
CMD="docker compose"
fi

$CMD --env-file env exec yaci-cli /bin/bash
$CMD --env-file env --env-file version exec yaci-cli /bin/bash

2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ then
CMD="docker compose"
fi

$CMD --env-file env up -d
$CMD --env-file env --env-file version up -d

source ./info.sh
2 changes: 1 addition & 1 deletion stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ then
CMD="docker compose"
fi

$CMD --env-file env kill
$CMD --env-file env --env-file version kill
2 changes: 2 additions & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tag=0.0.1-preview
revision=
2 changes: 1 addition & 1 deletion yaci-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ then
CMD="docker compose"
fi

$CMD --env-file env exec yaci-cli java -jar yaci-cli.jar
$CMD --env-file env --env-file version exec yaci-cli java -jar yaci-cli.jar

0 comments on commit 679146c

Please sign in to comment.