mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
Compare commits
2 Commits
1.0.0-alph
...
1.0.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55b84262b5 | ||
|
|
ce4252eb1a |
42
.github/workflows/docker.yml
vendored
42
.github/workflows/docker.yml
vendored
@@ -83,6 +83,8 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# For workflow_run events, checkout the specific commit that triggered the workflow
|
||||
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
||||
|
||||
- name: Check build conditions
|
||||
id: check
|
||||
@@ -114,17 +116,30 @@ jobs:
|
||||
# Use Git to generate consistent short SHA (ensures uniqueness like build.yml)
|
||||
short_sha=$(git rev-parse --short "${{ github.event.workflow_run.head_sha }}")
|
||||
|
||||
# Determine build type based on branch and commit
|
||||
if [[ "${{ github.event.workflow_run.head_branch }}" == "main" ]]; then
|
||||
build_type="development"
|
||||
version="dev-${short_sha}"
|
||||
# Skip Docker build for development builds
|
||||
should_build=false
|
||||
echo "⏭️ Skipping Docker build for development version (main branch)"
|
||||
elif [[ "${{ github.event.workflow_run.event }}" == "push" ]] && [[ "${{ github.event.workflow_run.head_branch }}" =~ ^refs/tags/ ]]; then
|
||||
# Tag push - only build for releases and prereleases
|
||||
tag_name="${{ github.event.workflow_run.head_branch }}"
|
||||
version="${tag_name#refs/tags/}"
|
||||
# Determine build type based on GitHub releases
|
||||
# Use GitHub API to check if this commit has a release/tag
|
||||
echo "🔍 Checking for releases/tags on commit ${{ github.event.workflow_run.head_sha }}"
|
||||
|
||||
# Get all tags for this repository and check if any point to this commit
|
||||
GITHUB_API_URL="https://api.github.com/repos/${{ github.repository }}/tags"
|
||||
|
||||
# Use curl to get tags (more reliable than git in workflow_run context)
|
||||
if command -v gh >/dev/null 2>&1; then
|
||||
# Use GitHub CLI if available
|
||||
tag_info=$(gh api repos/${{ github.repository }}/tags --jq '.[] | select(.commit.sha == "${{ github.event.workflow_run.head_sha }}") | .name' | head -n1)
|
||||
else
|
||||
# Fallback to curl
|
||||
tag_info=$(curl -s "$GITHUB_API_URL" | jq -r '.[] | select(.commit.sha == "${{ github.event.workflow_run.head_sha }}") | .name' | head -n1)
|
||||
fi
|
||||
|
||||
if [[ -n "$tag_info" ]] && [[ "$tag_info" != "null" ]]; then
|
||||
# This commit has a tag, treat as release build
|
||||
version="$tag_info"
|
||||
# Remove 'v' prefix if present for consistent version format
|
||||
if [[ "$version" == v* ]]; then
|
||||
version="${version#v}"
|
||||
fi
|
||||
|
||||
if [[ "$version" == *"alpha"* ]] || [[ "$version" == *"beta"* ]] || [[ "$version" == *"rc"* ]]; then
|
||||
build_type="prerelease"
|
||||
is_prerelease=true
|
||||
@@ -135,11 +150,12 @@ jobs:
|
||||
echo "🚀 Building Docker image for release: $version"
|
||||
fi
|
||||
else
|
||||
# No tag found, treat as development build
|
||||
build_type="development"
|
||||
version="dev-${short_sha}"
|
||||
# Skip Docker build for development builds
|
||||
should_build=false
|
||||
echo "⏭️ Skipping Docker build for development version"
|
||||
echo "⏭️ Skipping Docker build for development version (no tag found)"
|
||||
echo "🔍 Debug: Checked commit ${{ github.event.workflow_run.head_sha }} for tags"
|
||||
fi
|
||||
|
||||
echo "🔄 Build triggered by workflow_run:"
|
||||
|
||||
Reference in New Issue
Block a user