Skip to content
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release RC
name: Create RC Release PR

on:
workflow_dispatch:
Expand Down 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
81 changes: 81 additions & 0 deletions .github/workflows/create-rc-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Create RC Release

on:
workflow_dispatch:
inputs:
release_version:
description: "Release version"
required: true
issue_comment:
types: [created]

jobs:
release:
runs-on: macos-latest
if: ${{ github.event_name == 'issue_comment' && contains(github.event.comment.body, '/release-rc') && startsWith(github.event.issue.title, 'Release') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- 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.0"
Comment on lines +22 to +25
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

Action Version Update: Set Up Go
The step uses actions/setup-go@v4. Similar to the checkout action, please verify if a newer version (e.g., v5) is available to ensure the best performance and security practices are followed.

🧰 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)


- name: Add rocket emoji to comment
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"body": "🚀 Starting the release process!"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"

- name: Parse release version from PR title
id: parse_release_version
env:
GITHUB_ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
release_version=$(echo "$GITHUB_ISSUE_TITLE" | sed 's/ /\n/g' | tail -n 1)
echo "Release version: $release_version"
echo "release_version=$release_version" >> $GITHUB_OUTPUT

- name: Build for macOS
working-directory: ./wren-launcher
run: |
mkdir -p dist
env GOARCH=amd64 GOOS=darwin CGO_ENABLED=1 go build -o dist/wren-launcher-darwin main.go
cd dist && chmod +x wren-launcher-darwin && tar zcvf wren-launcher-darwin.tar.gz wren-launcher-darwin

- name: Build for Linux
working-directory: ./wren-launcher
run: |
mkdir -p dist
env GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -o dist/wren-launcher-linux main.go
cd dist && chmod +x wren-launcher-linux && tar zcvf wren-launcher-linux.tar.gz wren-launcher-linux

- name: Build for Windows
working-directory: ./wren-launcher
run: |
mkdir -p dist
env GOARCH=amd64 GOOS=windows CGO_ENABLED=0 go build -o dist/wren-launcher-windows.exe main.go
cd dist && zip wren-launcher-windows.zip wren-launcher-windows.exe

- 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: ${{ steps.parse_release_version.outputs.release_version }}
prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment with release link
run: |
release_url="https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse_release_version.outputs.release_version }}"
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{\"body\": \"🚀 A new release has been created! [View Release](${release_url})\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
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
Loading