Skip to content

Use release environment in release workflow#68

Open
oschwald wants to merge 1 commit into
mainfrom
greg/stf-42-release-workflow-environment
Open

Use release environment in release workflow#68
oschwald wants to merge 1 commit into
mainfrom
greg/stf-42-release-workflow-environment

Conversation

@oschwald

@oschwald oschwald commented Jul 3, 2026

Copy link
Copy Markdown
Member

Align the release workflow with mmdbinspect's structure.

  • Trigger on release: published instead of pushes of v* tags, and add workflow_dispatch, pull_request, and push-to-main triggers for CI.
  • Run the goreleaser job in the release deployment environment, so its deployment protection policy actually applies.
  • Scope contents: write to the job rather than the whole workflow.
  • Guard the job with if: github.event_name == 'release' && github.event.action == 'published' so it only runs for published releases.

Summary by CodeRabbit

  • Chores
    • Improved the release workflow so it responds to more common project events, including manual runs, pull requests, main-branch updates, and published releases.
    • Release publishing now runs only when a release is officially published, helping avoid unintended release actions.
    • Updated workflow access settings to better scope permissions during release execution.

Align the release workflow with mmdbinspect's: trigger on release:
published (with workflow_dispatch/pull_request/push-to-main for CI),
run the goreleaser job in the release deployment environment, scope
contents: write to the job, and guard the job so it only runs for
published releases.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release workflow's triggers were expanded to include workflow_dispatch, pull_request, and push to main, alongside published release events. The goreleaser job now runs only on published releases, is bound to a release environment, and permissions were moved from workflow-level to job-level.

Changes

Release Workflow Update

Layer / File(s) Summary
Trigger and gating adjustments
.github/workflows/release.yml
Adds workflow_dispatch, pull_request, and push (main) triggers alongside published release trigger; gates the goreleaser job to run only on published releases; adds a release environment; moves contents: write permission to job level.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A hop, a skip, a workflow tweak,
Triggers multiply, gates now speak.
Only published stars shall run the show,
Permissions tucked in job below.
🐇✨ Release day, off we go!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately highlights the main workflow change: running the release job in the release environment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/stf-42-release-workflow-environment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 4-16: The new workflow triggers are currently ineffective because
the only job, goreleaser, still runs only for github.event_name == 'release'
with action 'published'. Update the workflow so workflow_dispatch, pull_request,
and push either have a job that can actually run on those events or adjust the
goreleaser job’s if condition to allow the intended non-release paths; use the
goreleaser job definition and its event guard as the main place to fix this.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 64544e2f-9611-4d2d-a5f9-c1fefe18bd89

📥 Commits

Reviewing files that changed from the base of the PR and between 9e964ed and 09b4599.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment on lines +4 to +16
workflow_dispatch:
pull_request:
push:
tags:
- 'v*'

permissions:
contents: write
branches:
- main
release:
types:
- published

jobs:
goreleaser:
name: Release with GoReleaser
if: github.event_name == 'release' && github.event.action == 'published'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== release workflow =="
git ls-files .github/workflows/release.yml
wc -l .github/workflows/release.yml
cat -n .github/workflows/release.yml

echo
echo "== other workflow files mentioning release or goreleaser =="
rg -n "goreleaser|workflow_dispatch|pull_request|push:|release:" .github/workflows -S || true

Repository: maxmind/mmdbconvert

Length of output: 2771


New triggers are no-ops here

workflow_dispatch, pull_request, and push now start this workflow, but the only job is still limited to release/published, so PR and push runs will skip everything. If these events are meant to provide CI or manual release execution, add a non-release job or broaden the if guard.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 4 - 16, The new workflow triggers
are currently ineffective because the only job, goreleaser, still runs only for
github.event_name == 'release' with action 'published'. Update the workflow so
workflow_dispatch, pull_request, and push either have a job that can actually
run on those events or adjust the goreleaser job’s if condition to allow the
intended non-release paths; use the goreleaser job definition and its event
guard as the main place to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant