Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
push:
tags:
- '*'
workflow_call:
inputs:
version:
description: Version tag to publish (e.g. 1.0.0-beta.13)
required: false
type: string

jobs:
publish-to-dockerhub:
Expand All @@ -24,6 +30,9 @@ jobs:
uses: docker/metadata-action@v6
with:
images: codfish/json-server
tags: |
type=raw,value=${{ inputs.version }},enable=${{ inputs.version != '' }}
type=ref,event=tag,enable=${{ inputs.version == '' }}

- name: Build and push Docker image
uses: docker/build-push-action@v7
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
auto-tag:
name: Auto-tag based on json-server version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.tag.outputs.version }}
steps:
- name: Check out the repo
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Create or update tag
id: tag
run: |
VERSION=$(jq -r '.dependencies["json-server"]' package.json)
if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then
Expand All @@ -27,6 +30,7 @@ jobs:
fi
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")

echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "json-server version: $VERSION"
echo "Latest tag: $LATEST_TAG"

Expand All @@ -42,3 +46,10 @@ jobs:
git tag -a "$VERSION" -m "$VERSION"
git push origin "$VERSION" --force
fi

release:
needs: auto-tag
uses: ./.github/workflows/release.yml
with:
version: ${{ needs.auto-tag.outputs.version }}
secrets: inherit