Skip to content

create_release_candidate_command #33

create_release_candidate_command

create_release_candidate_command #33

name: Create Release Candidate
on:
repository_dispatch:
types: [create_release_candidate_command]
jobs:
validate:
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.commit.outputs.commit_hash }}
branch: release_candidate_build
message: ${{ steps.extract.outputs.message }}
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
- name: Extract metadata and validate parameters
id: extract
run: |
source .github/scripts/utils.sh
ISSUE_NUMBER="${{ github.event.client_payload.github.payload.issue.number }}"
REPO="${{ github.repository }}"
# Cache issue JSON
cache_issue_json "$ISSUE_NUMBER" "$REPO"
ISSUE_JSON=$(get_issue_json_path)
TITLE=$(jq -r '.title' "$ISSUE_JSON" | tr '[:upper:]' '[:lower:]')
if [[ ! "$TITLE" =~ ^release ]]; then
set_output "message" "❌ **Issue title must start with Release**"
exit 1
fi
validate_issue "release"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current commit hash
id: commit
run: |
source .github/scripts/utils.sh
SHA=$(git rev-parse HEAD)
set_output "commit_hash" "$SHA"
build:
needs: validate
uses: ./.github/workflows/build_from_hash.yml
with:
commit_hash: ${{ needs.validate.outputs.commit_hash }}
branch: ${{ needs.validate.outputs.branch }}
comment:
name: Report Result
needs: [ validate, build ]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Compose result title
id: title
run: |
source .github/scripts/utils.sh
STATUS="${{ needs.build.result }}"
if [ "$STATUS" = "success" ]; then
set_output "title" "✅ **Release Candidate Build succeeded**"
else
set_output "title" "❌ **Release Candidate Build failed**"
fi
- name: Post build comment
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
body: |
${{ steps.title.outputs.title }}
${{ needs.validate.outputs.message }}
**Commit Hash**: `${{ needs.validate.outputs.commit_hash }}`
**Branch**: `${{ needs.validate.outputs.branch }}`
**Run**: [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
_This release candidate was built for verification in QA. Use `/create_release <type>` after approval to finalize the release._
<!-- release-candidate: status=${{ needs.build.result }} commit=${{ needs.validate.outputs.commit_hash }} -->