Skip to content
45 changes: 45 additions & 0 deletions .github/workflows/create-rc-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# .github/workflows/release.yml
name: Create RC Release

on:
workflow_dispatch:
inputs:
release_version:
description: "Release version (e.g., 0.23.0-rc.1)"
required: true
jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

- name: Set up Go
uses: actions/setup-go@v4
with:
Comment on lines +22 to +24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Upgrade Setup-Go Action Version
Similarly, the workflow uses actions/setup-go@v4 on line 20–22. Checking for a newer version (such as actions/setup-go@v5) is recommended to ensure optimal performance and take advantage of recent enhancements and security updates.

🧰 Tools
🪛 actionlint (1.7.4)

21-21: 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)

go-version: "1.23" # Specify your Go version

- name: Build project
working-directory: ./wren-launcher
run: |
env GOARCH=amd64 GOOS=darwin CGO_ENABLED=0 go build -o dist/${BINARY_NAME}-darwin main.go
env GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -o dist/${BINARY_NAME}-linux main.go
env GOARCH=amd64 GOOS=windows CGO_ENABLED=0 go build -o dist/${BINARY_NAME}-windows.exe main.go
cd ./dist; chmod +x ${BINARY_NAME}-darwin && chmod +x ${BINARY_NAME}-linux \
&& tar zcvf ${BINARY_NAME}-darwin.tar.gz ${BINARY_NAME}-darwin \
&& tar zcvf ${BINARY_NAME}-linux.tar.gz ${BINARY_NAME}-linux \
&& zip ${BINARY_NAME}-windows.zip ${BINARY_NAME}-windows.exe

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Ensure BINARY_NAME is Defined
The build commands reference the environment variable ${BINARY_NAME} without any visible definition in the workflow. This may lead to build failures. Consider defining this variable at the job level or passing it as an additional input to the workflow. For example, you could add an env block at the job level with a default value for BINARY_NAME.


- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
./wren-launcher/dist/wren-launcher-darwin.tar.gz
./wren-launcher/dist/wren-launcher-linux.tar.gz
./wren-launcher/dist/wren-launcher-windows.zip
tag_name: ${{ github.event.inputs.release_version }}
prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 4 additions & 49 deletions .github/workflows/release-rc-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ jobs:
git config --global user.name "wren-ai[bot]"
git config --global user.email "dev@cannerdata.com"

- name: Create branch
run: |
BRANCH_NAME="release/${{ github.event.inputs.release_version }}"
git checkout -b $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV

- name: Update docker.go
run: |
FILE_PATH="wren-launcher/utils/docker.go"
Expand Down Expand Up @@ -70,51 +64,12 @@ jobs:
echo "===== Git diff for changed files ====="
git diff

- name: Commit changes
run: |
git add wren-launcher/utils/docker.go docker/.env.example
git commit -m "release ${{ github.event.inputs.release_version }}" || echo "No changes to commit"
git status

- name: Push branch
run: |
git push --set-upstream origin ${{ env.BRANCH_NAME }}
echo "Branch pushed to origin/${{ env.BRANCH_NAME }}"

- name: Install GitHub CLI
run: |
type -p curl >/dev/null || (apt update && apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y

- name: Create Pull Request with GitHub CLI
run: |
# Check if branch has changes compared to main
if git diff --quiet origin/main origin/${{ env.BRANCH_NAME }}; then
echo "No changes detected between main and ${{ env.BRANCH_NAME }}. Cannot create PR."
exit 1
fi

# Create PR using gh cli
gh pr create \
--title "Release ${{ github.event.inputs.release_version }}" \
--body "Release ${{ github.event.inputs.release_version }}" \
--base main \
--head ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fallback PR creation
if: failure()
uses: peter-evans/create-pull-request@v5
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "release ${{ github.event.inputs.release_version }}"
branch: ${{ env.BRANCH_NAME }}
base: main
branch: "release/${{ github.event.inputs.release_version }}"
commit-message: "release ${{ github.event.inputs.release_version }}"
title: "Release ${{ github.event.inputs.release_version }}"
body: "Release ${{ github.event.inputs.release_version }}"
draft: false
4 changes: 2 additions & 2 deletions wren-launcher/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ BINARY_NAME=wren-launcher

build:
env GOARCH=amd64 GOOS=darwin CGO_ENABLED=1 go build -o dist/${BINARY_NAME}-darwin main.go
env GOARCH=amd64 GOOS=linux go build -o dist/${BINARY_NAME}-linux main.go
env GOARCH=amd64 GOOS=windows go build -o dist/${BINARY_NAME}-windows.exe main.go
env GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -o dist/${BINARY_NAME}-linux main.go
env GOARCH=amd64 GOOS=windows CGO_ENABLED=0 go build -o dist/${BINARY_NAME}-windows.exe main.go
cd ./dist; chmod +x ${BINARY_NAME}-darwin && chmod +x ${BINARY_NAME}-linux \
&& tar zcvf ${BINARY_NAME}-darwin.tar.gz ${BINARY_NAME}-darwin \
&& tar zcvf ${BINARY_NAME}-linux.tar.gz ${BINARY_NAME}-linux \
Expand Down