Repository navigation
ci: configure GitHub release workflows #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name-template: "v$RESOLVED_VERSION" | ||
| tag-template: "v$RESOLVED_VERSION" | ||
|
|
||
| categories: | ||
| - title: "🚀 Features" | ||
| labels: | ||
| - "feature" | ||
| - "enhancement" | ||
| - "feat" | ||
| - title: "🐛 Bug Fixes" | ||
| labels: | ||
| - "fix" | ||
| - "bugfix" | ||
| - "bug" | ||
| - title: "🧰 Maintenance" | ||
| labels: | ||
| - "chore" | ||
| - "maintenance" | ||
| - "refactor" | ||
| - title: "📝 Documentation" | ||
| labels: | ||
| - "documentation" | ||
| - "docs" | ||
| - title: "🔧 Configuration" | ||
| labels: | ||
| - "configuration" | ||
| - "config" | ||
| - title: "🧪 Tests" | ||
| labels: | ||
| - "tests" | ||
| - "test" | ||
| - title: "⬆️ Dependencies" | ||
| labels: | ||
| - "dependencies" | ||
| - "deps" | ||
| - title: "🎨 Frontend" | ||
| labels: | ||
| - "frontend" | ||
| - "ui" | ||
| - title: "⚙️ Backend" | ||
| labels: | ||
| - "backend" | ||
| - "api" | ||
| - title: "🔐 Security" | ||
| labels: | ||
| - "security" | ||
| - title: "🐳 Docker" | ||
| labels: | ||
| - "docker" | ||
| - title: "🚀 CI/CD" | ||
| labels: | ||
| - "ci-cd" | ||
| - "github-actions" | ||
| - title: "👥 Contributors" | ||
| labels: | ||
| - "first-time-contributor" | ||
| - "external-contributor" | ||
|
|
||
| change-template: "- $TITLE @$AUTHOR (#$NUMBER)" | ||
| change-title-escapes: '\<*_&' | ||
|
|
||
| template: | | ||
| # DebateAI $RESOLVED_VERSION | ||
|
|
||
| An open-source platform for structured human and AI debates, | ||
| real-time debate rooms, and AI-assisted judging. | ||
|
|
||
| ## What's Changed | ||
|
|
||
| $CHANGES | ||
|
|
||
| ## Contributors | ||
|
|
||
| $CONTRIBUTORS | ||
|
|
||
| **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION | ||
|
|
||
| exclude-labels: | ||
| - "skip-changelog" | ||
| - "no-changelog" | ||
| - "duplicate" | ||
| - "invalid" | ||
| - "wontfix" | ||
|
|
||
| replacers: | ||
| - search: '/CVE-(\d{4})-(\d+)/g' | ||
| replace: "[CVE-$1-$2](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-$1-$2)" | ||
|
|
||
| include-pre-releases: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Release Drafter | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - master | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| update_release_draft: | ||
| if: ${{ github.repository_owner == 'AOSSIE-Org' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Run Release Drafter | ||
| uses: release-drafter/release-drafter@v6 | ||
| with: | ||
| config-name: release-drafter.yml | ||
| disable-autolabeler: false | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: Version Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Release version (e.g. 0.1.0)" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| if: ${{ github.repository_owner == 'AOSSIE-Org' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check out the intended release branch before creating the tag. An operator can dispatch this workflow on a branch other than the default branch. Checkout then selects that branch, and Line 80 tags its commit while the job publishes the repository's sole draft. A release can consequently point to code outside the branch used to draft its changes. Restrict dispatch to the intended release branch and check out that branch explicitly. (docs.github.com) 🧰 Tools
|
||
|
|
||
| - name: Validate version | ||
| id: get_version | ||
| env: | ||
| INPUT_VERSION: ${{ inputs.version }} | ||
| run: | | ||
| VERSION="${INPUT_VERSION#v}" | ||
|
|
||
| if ! [[ "$VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then | ||
| echo "Error: enter a version such as 0.1.0" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Check if tag already exists | ||
| env: | ||
| TAG: ${{ steps.get_version.outputs.tag }} | ||
| run: | | ||
| git fetch --tags | ||
|
|
||
| if git show-ref --tags --verify --quiet "refs/tags/$TAG"; then | ||
| echo "Error: tag $TAG already exists" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Find draft release | ||
| id: draft | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { owner, repo } = context.repo; | ||
| const { data: releases } = await github.rest.repos.listReleases({ | ||
| owner, | ||
| repo, | ||
| per_page: 100 | ||
| }); | ||
|
|
||
| const drafts = releases.filter(r => r.draft); | ||
|
|
||
| if (drafts.length !== 1) { | ||
| core.setFailed( | ||
| `Expected exactly one draft release, found ${drafts.length}.` | ||
| ); | ||
| return; | ||
| } | ||
|
|
||
| core.setOutput('release_id', String(drafts[0].id)); | ||
|
|
||
| - name: Create and push tag | ||
| env: | ||
| TAG: ${{ steps.get_version.outputs.tag }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git tag -a "$TAG" -m "Release $TAG" | ||
| git push origin "$TAG" | ||
|
Comment on lines
+80
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make tag creation recoverable when publication fails. The job pushes the tag before
|
||
|
|
||
| - name: Publish draft release | ||
| uses: actions/github-script@v7 | ||
| env: | ||
| TAG: ${{ steps.get_version.outputs.tag }} | ||
| RELEASE_ID: ${{ steps.draft.outputs.release_id }} | ||
| with: | ||
| script: | | ||
| const { owner, repo } = context.repo; | ||
| const releaseId = Number(process.env.RELEASE_ID); | ||
| const tag = process.env.TAG; | ||
|
|
||
| const { data: release } = await github.rest.repos.getRelease({ | ||
| owner, | ||
| repo, | ||
| release_id: releaseId | ||
| }); | ||
|
|
||
| if (!release.draft) { | ||
| core.setFailed('The selected release is no longer a draft.'); | ||
| return; | ||
| } | ||
|
|
||
| await github.rest.repos.updateRelease({ | ||
| owner, | ||
| repo, | ||
| release_id: releaseId, | ||
| tag_name: tag, | ||
| name: `DebateAI ${tag}`, | ||
| draft: false, | ||
| prerelease: false | ||
| }); | ||
|
Comment on lines
+105
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the published tag consistent with the draft body. The version check accepts any unused semantic-version tag, but Release Drafter has already expanded
|
||
|
|
||
| core.notice(`Published DebateAI ${tag}`); | ||
|
|
||
| - name: Release summary | ||
| if: always() | ||
| env: | ||
| VERSION: ${{ steps.get_version.outputs.tag }} | ||
| run: | | ||
| { | ||
| echo "## DebateAI Release" | ||
| echo "- Version: ${VERSION:-Not validated}" | ||
| echo "- Status: ${{ job.status }}" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve feature versions before naming drafts.
The
feature,enhancement, andfeatlabels only classify changelog entries. Without aversion-resolver, those labels do not request a minor increment. A feature release can therefore receive a patch-version draft name and tag. Map feature labels tominor, and set a fallback for other changes. (raw.githubusercontent.com)