Skip to content
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

ci: add build-release workflow and decouple Goreleaser #1311

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

KeisukeYamashita
Copy link
Contributor

@KeisukeYamashita KeisukeYamashita commented Dec 12, 2024

Overview

What I've done

What I haven't done

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Introduced a new GitHub Actions workflow for automated building and releasing of software versions.
    • Added a build-release job to the CI workflow, enhancing the release process.
  • Bug Fixes

    • Removed the outdated build-server job to streamline the workflow.
  • Chores

    • Updated conditions for the build-docker-image job to improve execution logic.

@KeisukeYamashita KeisukeYamashita self-assigned this Dec 12, 2024
Copy link

coderabbitai bot commented Dec 12, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

A new GitHub Actions workflow named build-release has been added to automate the process of building and releasing software versions. This workflow is triggered by a workflow_call event and requires specific input parameters. Additionally, the existing build-server job has been removed from the build_server.yml file, while the build-docker-image job remains with updated execution conditions. The CI workflow has been updated to include the new build-release job, which depends on previous jobs and integrates the new release workflow.

Changes

File Change Summary
.github/workflows/build_release.yml Added a new workflow build-release with various steps for building and releasing software.
.github/workflows/build_server.yml Removed the build-server job; retained and updated conditions for the build-docker-image job.
.github/workflows/ci.yml Introduced a new job build-release that depends on build-prepare and ci-server, integrating the new release workflow.

Possibly related PRs

Poem

🐇 In the meadow, we hop with glee,
A new workflow blooms, as bright as can be!
With builds and releases, all set in a row,
The rabbit team dances, putting on a show!
Hooray for the changes, let’s cheer and delight,
For every new feature makes our work feel just right! 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9122b2e and 622397c.

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

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Dec 12, 2024

Deploy Preview for reearth-web canceled.

Name Link
🔨 Latest commit 622397c
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/675adf5f6b5364000966dff2

@KeisukeYamashita KeisukeYamashita marked this pull request as ready for review December 12, 2024 12:23
Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7efbf1f and 9122b2e.

📒 Files selected for processing (3)
  • .github/workflows/build_release.yml (1 hunks)
  • .github/workflows/build_server.yml (0 hunks)
  • .github/workflows/ci.yml (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/build_server.yml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build_release.yml

30-30: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


34-34: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "goreleaser/goreleaser-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


48-48: shellcheck reported issue in this script: SC2086:info:1:28: Double quote to prevent globbing and word splitting

(shellcheck)


48-48: shellcheck reported issue in this script: SC2046:warning:1:31: Quote this to prevent word splitting

(shellcheck)


48-48: shellcheck reported issue in this script: SC2086:info:1:38: Double quote to prevent globbing and word splitting

(shellcheck)


64-64: the runner of "dawidd6/action-download-artifact@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (3)
.github/workflows/build_release.yml (2)

1-20: LGTM: Well-structured workflow inputs

The workflow is properly configured as a reusable workflow with all necessary inputs for versioning and identification.


68-77: 🛠️ Refactor suggestion

Verify changelog file existence

The workflow attempts to use CHANGELOG_latest.md without verifying its existence after download.

Add a verification step:

- name: Verify changelog
  if: ${{ inputs.new_tag != '' }}
  run: |
    if [ ! -f CHANGELOG_latest.md ]; then
      echo "::error::CHANGELOG_latest.md not found"
      exit 1
    fi
.github/workflows/ci.yml (1)

86-96: Verify job dependencies and deployment impact

The job dependencies look correct, but we should verify that this doesn't affect the deployment jobs.

The new build-release job is properly integrated into the workflow with correct dependencies and input passing.

✅ Verification successful

Build-release job integration verified and safe

The verification confirms that the new build-release job does not interfere with the existing deployment flow:

  • deploy-web depends only on build-web
  • deploy-server depends only on build-server
  • No other jobs depend on build-server except the ones we've seen
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if deployment jobs have any conditions that might be affected
rg -A 5 "deploy-(web|server):" .github/workflows/ci.yml

# Check for any other jobs that might depend on build-server
ast-grep --pattern 'needs:.*build-server.*'

Length of output: 331

Comment on lines +29 to +46
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ~> v2
args: release --clean ${{ inputs.new_tag == '' && '--snapshot' || '' }}
workdir: server
env:
GORELEASER_CURRENT_TAG: ${{ inputs.new_tag == '' && '0.0.0' || inputs.new_tag }}
- name: Rename artifacts
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update GitHub Actions to their latest versions

Several actions are using outdated versions which may have security fixes or improvements in newer versions.

Apply these version updates:

- uses: actions/checkout@v3
+ uses: actions/checkout@v4

- uses: actions/setup-go@v4
+ uses: actions/setup-go@v5

- uses: goreleaser/goreleaser-action@v4
+ uses: goreleaser/goreleaser-action@v5
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ~> v2
args: release --clean ${{ inputs.new_tag == '' && '--snapshot' || '' }}
workdir: server
env:
GORELEASER_CURRENT_TAG: ${{ inputs.new_tag == '' && '0.0.0' || inputs.new_tag }}
- name: Rename artifacts
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: ~> v2
args: release --clean ${{ inputs.new_tag == '' && '--snapshot' || '' }}
workdir: server
env:
GORELEASER_CURRENT_TAG: ${{ inputs.new_tag == '' && '0.0.0' || inputs.new_tag }}
- name: Rename artifacts
🧰 Tools
🪛 actionlint (1.7.4)

30-30: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


34-34: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "goreleaser/goreleaser-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +63 to +68
if: ${{ inputs.new_tag != '' }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: release.yml
name: changelog-${{ inputs.new_tag }}
- name: Create GitHub release
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action-download-artifact to latest version

The action for downloading artifacts is using an outdated version.

Apply this version update:

- uses: dawidd6/action-download-artifact@v2
+ uses: dawidd6/action-download-artifact@v3
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: ${{ inputs.new_tag != '' }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: release.yml
name: changelog-${{ inputs.new_tag }}
- name: Create GitHub release
if: ${{ inputs.new_tag != '' }}
uses: dawidd6/action-download-artifact@v3
with:
workflow: release.yml
name: changelog-${{ inputs.new_tag }}
- name: Create GitHub release
🧰 Tools
🪛 actionlint (1.7.4)

64-64: the runner of "dawidd6/action-download-artifact@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +47 to +49
if: ${{ inputs.name != '' }}
run: for f in $ARTIFACTS; do mv $f $(echo $f | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/'); done
- name: List artifacts
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix shell script quoting issues

The artifact renaming step has potential issues with word splitting and globbing.

Apply this fix:

- run: for f in $ARTIFACTS; do mv $f $(echo $f | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/'); done
+ run: for f in "$ARTIFACTS"; do mv "$f" "$(echo "$f" | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/')"; done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: ${{ inputs.name != '' }}
run: for f in $ARTIFACTS; do mv $f $(echo $f | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/'); done
- name: List artifacts
if: ${{ inputs.name != '' }}
run: for f in "$ARTIFACTS"; do mv "$f" "$(echo "$f" | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/')"; done
- name: List artifacts
🧰 Tools
🪛 actionlint (1.7.4)

48-48: shellcheck reported issue in this script: SC2086:info:1:28: Double quote to prevent globbing and word splitting

(shellcheck)


48-48: shellcheck reported issue in this script: SC2046:warning:1:31: Quote this to prevent word splitting

(shellcheck)


48-48: shellcheck reported issue in this script: SC2086:info:1:38: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@rot1024 rot1024 merged commit 70e28e9 into main Dec 12, 2024
3 checks passed
@rot1024 rot1024 deleted the add-release-workflow branch December 12, 2024 13:04
ZTongci pushed a commit that referenced this pull request Dec 17, 2024
Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants