Skip to content

Commit

Permalink
fix: update versions in release and canary workflows (#911)
Browse files Browse the repository at this point in the history
Co-authored-by: Salman Mohammed <[email protected]>
  • Loading branch information
lily-de and salman1993 authored Jan 31, 2025
1 parent 3569c6a commit 3d0c58e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 19 deletions.
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
# 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
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
# ------------------------------------
# 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
40 changes: 29 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,57 @@ on:
- "v1.*"

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/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,27 +67,25 @@ 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
Expand All @@ -91,3 +108,4 @@ jobs:
allowUpdates: true
omitBody: true
omitPrereleaseDuringUpdate: true

0 comments on commit 3d0c58e

Please sign in to comment.