Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gha/publish): add docker image labels #242

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
8 changes: 5 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
earthly +docker-publish \
--PUSH=${DOCKER_PUSH} \
--DOCKER_REGISTRIES="${DOCKER_REGISTRIES}" \
--DOCKER_IMAGES_LABELS="${DOCKER_METADATA_OUTPUT_LABELS_COMMA_SEPARATED}" \
--DOCKER_IMAGES_EXTRA_TAGS="${EARTHLY_DOCKER_IMAGES_EXTRA_TAGS}"

- name: Create Github release and upload jar files
Expand All @@ -113,12 +114,13 @@ jobs:
- name: Bump versions
if: github.ref_type == 'tag'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch --all --tags

# Bump version only if tag's commit belongs to main branch
if [ $(git for-each-ref | grep ^${GIT_SHORT_COMMIT} | grep refs.remotes.origin | sed 's|.*refs/remotes/origin/\(.*\)|\1|' | grep -c ^main$) -gt 0 ]
then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch --all --tags
sed -i "s|^version.*|version = ${NEW_ARTIFACT_SNAPSHOT_VERSION}-SNAPSHOT|" gradle.properties
git commit gradle.properties -m "chore(gradle): Bump version to ${NEW_ARTIFACT_SNAPSHOT_VERSION}-SNAPSHOT (automated commit by gha run id $GITHUB_RUN_ID)"

Expand Down
7 changes: 5 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ARG --global DOCKER_IMAGES_TARGETS="ledger-sync aggregation streamer scheduler"

ARG --global DOCKER_IMAGE_PREFIX="cf-ledger-sync"
ARG --global DOCKER_IMAGES_EXTRA_TAGS=""
ARG --global DOCKER_IMAGES_LABELS=""
ARG --global DOCKER_REGISTRIES=""
ARG --global PUSH=false

Expand All @@ -27,10 +28,12 @@ TEMPLATED_DOCKERFILE_BUILD:
FUNCTION
ARG DOCKERFILE_TARGET
ARG DOCKER_IMAGE_NAME
FROM DOCKERFILE --build-arg GRADLE_BUILD_ARGS=${GRADLE_BUILD_ARGS} -f Dockerfile --target ${DOCKERFILE_TARGET} .
WAIT
FROM DOCKERFILE --build-arg GRADLE_BUILD_ARGS=${GRADLE_BUILD_ARGS} -f Dockerfile --target ${DOCKERFILE_TARGET} .
DO functions+DOCKER_LABELS --LABELS="${DOCKER_IMAGES_LABELS}"
END
SAVE IMAGE ${DOCKER_IMAGE_NAME}:latest


gradle-build:
FROM DOCKERFILE \
--build-arg GRADLE_BUILD_ARGS="${GRADLE_BUILD_ARGS}" \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"
services:
cf-ledger-sync:
restart: unless-stopped
image: ${CF_LEDGER_SYNC_DOCKER_IMAGE:-cardanofoundation/cf-ledger-sync:0.1.0}
image: ${CF_LEDGER_SYNC_DOCKER_IMAGE:-cardanofoundation/cf-ledger-sync:0.1.1}
environment:
- NETWORK=${NETWORK:-preprod}
- DB_DIALECT=${DB_DIALECT:-org.hibernate.dialect.PostgreSQLDialect}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group = org.cardanofoundation
version = 0.1.1
version = 0.1.2-SNAPSHOT
Loading