Release Drafter #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Drafter | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - master | |
| - 'release_*' | |
| pull_request_target: | |
| types: [opened, reopened, synchronize] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to use for the release draft (optional)' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: read | |
| jobs: | |
| update_release_draft: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| if: github.repository == 'ahmedhamidawan/galaxy' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| lib/galaxy/version.py | |
| - name: Read Galaxy version | |
| id: galaxy-version | |
| run: | | |
| # Extract VERSION_MAJOR from version.py (e.g., "25.1") | |
| VERSION_MAJOR=$(grep '^VERSION_MAJOR' lib/galaxy/version.py | cut -d'"' -f2) | |
| RELEASE_VERSION="${VERSION_MAJOR}.0" | |
| echo "version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | |
| echo "Galaxy release version: ${RELEASE_VERSION}" | |
| - name: Check if we should update draft | |
| id: check-draft | |
| run: | | |
| VERSION="${{ inputs.version || steps.galaxy-version.outputs.version }}" | |
| # Check if this version is already published | |
| PUBLISHED=$(gh release view "v${VERSION}" --json isDraft --jq '.isDraft' 2>/dev/null || echo "not_found") | |
| if [ "$PUBLISHED" = "false" ]; then | |
| echo "Published release v${VERSION} already exists. Skipping." | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Check if a draft exists for a DIFFERENT version (only one draft at a time) | |
| EXISTING_DRAFT=$(gh release list --limit 50 --json tagName,isDraft --jq '.[] | select(.isDraft == true) | .tagName' | head -1) | |
| if [ -n "$EXISTING_DRAFT" ] && [ "$EXISTING_DRAFT" != "v${VERSION}" ]; then | |
| echo "Draft release $EXISTING_DRAFT already exists (for different version). Skipping v${VERSION}." | |
| echo "Only one draft release at a time is supported." | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Proceeding with draft for v${VERSION}." | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: release-drafter/release-drafter@v6 | |
| if: steps.check-draft.outputs.skip == 'false' | |
| with: | |
| config-name: release-drafter.yml | |
| version: ${{ inputs.version || steps.galaxy-version.outputs.version }} | |
| filter-by-commitish: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |