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

fix: update versions in release and canary workflows #911

Merged
merged 6 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
on:
workflow_call:
inputs:
version:
required: true
type: string
salman1993 marked this conversation as resolved.
Show resolved Hide resolved
# Let's allow overriding the OSes and architectures in JSON array form:
# e.g. '["ubuntu-latest","macos-latest"]'
# If no input is provided, these defaults apply.
Expand Down Expand Up @@ -38,7 +41,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
- name: Update version in Cargo.toml
run: |
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml
rm -f Cargo.toml.bak

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
Expand Down Expand Up @@ -66,4 +74,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }}
path: ${{ env.ARTIFACT }}
path: ${{ env.ARTIFACT }}
19 changes: 17 additions & 2 deletions .github/workflows/bundle-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
on:
workflow_call:
inputs:
version:
description: 'Version to set for the build'
required: true
type: string
kalvinnchau marked this conversation as resolved.
Show resolved Hide resolved
signing:
description: 'Whether to perform signing and notarization'
required: false
Expand Down Expand Up @@ -69,6 +73,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# Update versions before build
- name: Update versions
run: |
# Update version in Cargo.toml
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml
rm -f Cargo.toml.bak

# Update version in package.json
cd ui/desktop
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -98,13 +113,13 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-build-

# Rest of the workflow remains the same...
- name: Build goosed
run: cargo build --release -p goose-server

- name: Copy binary into Electron folder
run: cp target/release/goosed ui/desktop/src/bin/goosed

# Conditional Signing Step - we skip this for faster builds
- name: Add MacOS certs for signing and notarization
if: ${{ inputs.signing }}
run: ./add-macos-cert.sh
Expand Down Expand Up @@ -201,4 +216,4 @@ jobs:
exit 1
fi
# Kill the app to clean up
pkill -f "Goose.app/Contents/MacOS/Goose"
pkill -f "Goose.app/Contents/MacOS/Goose"
30 changes: 26 additions & 4 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,33 @@ concurrency:

jobs:
# ------------------------------------
# 1) Build CLI for multiple OS/Arch
# 1) Prepare Version
# ------------------------------------
prepare-version:
name: Prepare Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Generate a canary version
id: set-version
run: |
# Something like "1.0.0-canary.<short sha>"
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
VERSION="1.0.0-canary.${SHORT_SHA}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
Comment on lines +31 to +34
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can use the git describe method to get the latest tag

❯ git describe --tags --abbrev=0
v1.0.2

something like

SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
LATEST_TAG=$(git describe --tags --abbrev=0)

# Strip the leading 'v' if it exists
CLEAN_TAG=${LATEST_TAG#v}

VERSION="${CLEAN_TAG}-canary.${SHORT_SHA}"
echo "version=$VERSION" >> $GITHUB_OUTPUT


# ------------------------------------
# 2) Build CLI for multiple OS/Arch
# ------------------------------------
build-cli:
needs: [prepare-version]
uses: ./.github/workflows/build-cli.yml
with:
version: ${{ needs.prepare-version.outputs.version }}

# ------------------------------------
# 2) Upload Install CLI Script (we only need to do this once)
# 3) Upload Install CLI Script (we only need to do this once)
# ------------------------------------
install-script:
name: Upload Install Script
Expand All @@ -37,11 +57,13 @@ jobs:
path: download_cli.sh

# ------------------------------------------------------------
# 3) Bundle Desktop App (macOS only) - builds goosed and Electron app
# 4) Bundle Desktop App (macOS only) - builds goosed and Electron app
# ------------------------------------------------------------
bundle-desktop:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop.yml
with:
version: ${{ needs.prepare-version.outputs.version }}
signing: true
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
Expand All @@ -51,7 +73,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

# ------------------------------------
# 4) Create/Update GitHub Release
# 5) Create/Update GitHub Release
# ------------------------------------
release:
name: Release
Expand Down
73 changes: 47 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,60 @@ on:
- 'documentation/**'
tags:
- "v1.*"

- 'test.*' # TODO: remove after testing
name: Release

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# ------------------------------------
# 1) Build CLI for multiple OS/Arch
# 1) Set version variables first
# ------------------------------------
prepare-version:
name: Prepare Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Extract version
id: set-version
run: |
VERSION=${GITHUB_REF#refs/tags/test.} # TODO: remove after testing
# VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

# ------------------------------------
# 3) Build CLI for multiple OS/Arch
# ------------------------------------
build-cli:
needs: [prepare-version]
uses: ./.github/workflows/build-cli.yml
with:
version: ${{ needs.prepare-version.outputs.version }}

# ------------------------------------
# 2) Upload Install CLI Script (we only need to do this once)
# 4) Upload Install CLI Script
# ------------------------------------
install-script:
name: Upload Install Script
runs-on: ubuntu-latest
needs: [ build-cli ]
needs: [build-cli]
steps:
- uses: actions/checkout@v4
- uses: actions/upload-artifact@v4
with:
name: download_cli.sh
path: download_cli.sh

# ------------------------------------------------------------
# 3) Bundle Desktop App (macOS only) - builds goosed and Electron app
# 5) Bundle Desktop App (macOS only)
# ------------------------------------------------------------
bundle-desktop:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop.yml
with:
version: ${{ needs.prepare-version.outputs.version }}
signing: true
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
Expand All @@ -48,46 +68,47 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

# ------------------------------------
# 4) Create/Update GitHub Release
# 6) Create/Update GitHub Release
# ------------------------------------
release:
name: Release
runs-on: ubuntu-latest
needs: [ build-cli, install-script, bundle-desktop ]
needs: [build-cli, install-script, bundle-desktop]
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

# Create/update the versioned release
- name: Release versioned
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# This pattern will match both goose tar.bz2 artifacts and the Goose.zip
artifacts: |
goose-*.tar.bz2
Goose*.zip
download_cli.sh
allowUpdates: true
omitBody: true
omitPrereleaseDuringUpdate: true
prerelease: true # TODO: remove after testing
draft: true # TODO: remove after testing

# Create/update the stable release
- name: Release stable
uses: ncipollo/release-action@v1
with:
tag: stable
name: Stable
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
goose-*.tar.bz2
Goose*.zip
download_cli.sh
allowUpdates: true
omitBody: true
omitPrereleaseDuringUpdate: true
# TODO: uncomment after testing. otherwise, this replaces the assets in the stable release
# # Create/update the stable release
# - name: Release stable
# uses: ncipollo/release-action@v1
# with:
# tag: stable
# name: Stable
# token: ${{ secrets.GITHUB_TOKEN }}
# artifacts: |
# goose-*.tar.bz2
# Goose*.zip
# download_cli.sh
# allowUpdates: true
# omitBody: true
# omitPrereleaseDuringUpdate: true