Skip to content

Commit

Permalink
chore: Add github action file to include Earthly
Browse files Browse the repository at this point in the history
  • Loading branch information
satran004 committed Apr 24, 2024
1 parent 2066408 commit 8f3f6be
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and Release
on:
push:
tags:
- 'v*'

jobs:
buildAndPush:
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: earthly/actions-setup@v1
with:
version: v0.8.0
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: actions/checkout@v4
- name: Docker Login
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
- name: Run build
run: earthly --ci --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 }}
12 changes: 9 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ VERSION 0.8

ARG --global ALL_BUILD_TARGETS="cli viewer"
ARG --global DOCKER_IMAGE_PREFIX="yaci"
ARG --global TAG="0.0.20-beta2-SNAPSHOT"
ARG --global TAG="0.0.1-preview"

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

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

cli:
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}-${EARTHLY_TARGET_NAME}:${TAG}
SAVE IMAGE bloxbean/${DOCKER_IMAGE_PREFIX}-devkit:${TAG}

viewer:
ARG EARTHLY_TARGET_NAME
Expand Down

0 comments on commit 8f3f6be

Please sign in to comment.