mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-11 17:00:13 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cf4acf7e9 |
@@ -8,6 +8,8 @@ name: Build and Push CLI Docker Image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
tags:
|
tags:
|
||||||
- "*.*.*-cli"
|
- "*.*.*-cli"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -41,14 +43,32 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(jq -r '.version' manifest.json)
|
VERSION=$(jq -r '.version' manifest.json)
|
||||||
EPOCH=$(date +%s)
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||||
TAG="${VERSION}-${EPOCH}-cli"
|
|
||||||
IMAGE="ghcr.io/${{ github.repository_owner }}/livesync-cli"
|
IMAGE="ghcr.io/${{ github.repository_owner }}/livesync-cli"
|
||||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
||||||
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
|
# Build tag list based on the event and git ref
|
||||||
echo "full=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT
|
TAGS=""
|
||||||
echo "version=${IMAGE}:${VERSION}-cli" >> $GITHUB_OUTPUT
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
echo "latest=${IMAGE}:latest" >> $GITHUB_OUTPUT
|
# Stable release builds
|
||||||
|
TAGS="${IMAGE}:${VERSION}-cli,${IMAGE}:latest,${IMAGE}:${VERSION}-sha-${SHORT_SHA}-cli"
|
||||||
|
elif [[ "${{ github.ref }}" == refs/heads/main ]]; then
|
||||||
|
# Bleeding-edge / nightly builds
|
||||||
|
TAGS="${IMAGE}:edge,${IMAGE}:${VERSION}-dev-sha-${SHORT_SHA}-cli"
|
||||||
|
else
|
||||||
|
# Other branches / manual run fallback
|
||||||
|
TAGS="${IMAGE}:${VERSION}-dev-sha-${SHORT_SHA}-cli"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine if the image should be pushed
|
||||||
|
PUSH="true"
|
||||||
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
|
||||||
|
PUSH="false"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
|
||||||
|
echo "push=${PUSH}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -92,10 +112,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: src/apps/cli/Dockerfile
|
file: src/apps/cli/Dockerfile
|
||||||
push: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
|
push: ${{ steps.meta.outputs.push }}
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ steps.meta.outputs.full }}
|
|
||||||
${{ steps.meta.outputs.version }}
|
|
||||||
${{ steps.meta.outputs.latest }}
|
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
Reference in New Issue
Block a user