Skip to content

Pre-Release Check

Pre-Release Check #20

Workflow file for this run

name: Pre-Release Check
on:
workflow_dispatch:
inputs:
version:
description: 'Version bump type to simulate'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
test:
name: Run Tests
uses: ./.github/workflows/test-ruby.yml
permissions:
contents: read
docker-build:
name: Test Docker Build
needs: [test]
uses: ./.github/workflows/docker-build.yml
with:
push: false
version: test-${{ github.run_number }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
version-check:
name: Check Version Calculation
runs-on: ubuntu-latest
needs: [test]
outputs:
current: ${{ steps.current.outputs.version }}
new: ${{ steps.new.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get current version
id: current
run: |
CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
CURRENT_VERSION=${CURRENT_VERSION#v}
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
- name: Calculate new version
id: new
run: |
CURRENT="${{ steps.current.outputs.version }}"
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
case "${{ inputs.version }}" in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
minor)
NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
;;
patch)
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
;;
esac
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Display version info
run: |
echo "Current version: ${{ steps.current.outputs.version }}"
echo "New version would be: ${{ steps.new.outputs.version }}"
summary:
name: Pre-Release Summary
runs-on: ubuntu-latest
needs: [test, docker-build, version-check]
if: always()
steps:
- name: Summary
run: |
echo "## Pre-Release Check Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Version Information" >> $GITHUB_STEP_SUMMARY
echo "- Current: v${{ needs.version-check.outputs.current }}" >> $GITHUB_STEP_SUMMARY
echo "- Would become: v${{ needs.version-check.outputs.new }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Check Results" >> $GITHUB_STEP_SUMMARY
echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Tests | ${{ needs.test.result == 'success' && '✅' || '❌' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Docker Build | ${{ needs.docker-build.result == 'success' && '✅' || '❌' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.test.result }}" == "success" && \
"${{ needs.docker-build.result }}" == "success" ]]; then
echo "✅ **All checks passed! Ready for release.**" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Some checks failed. Please fix issues before releasing.**" >> $GITHUB_STEP_SUMMARY
fi