fix: update versions in release and canary workflows (#911)

Co-authored-by: Salman Mohammed <smohammed@squareup.com>
This commit is contained in:
lily-de
2025-01-30 19:21:12 -05:00
committed by GitHub
parent 3569c6abee
commit 3d0c58e5f3
4 changed files with 86 additions and 23 deletions
+10 -2
View File
@@ -5,6 +5,9 @@
on: on:
workflow_call: workflow_call:
inputs: inputs:
version:
required: true
type: string
# Let's allow overriding the OSes and architectures in JSON array form: # Let's allow overriding the OSes and architectures in JSON array form:
# e.g. '["ubuntu-latest","macos-latest"]' # e.g. '["ubuntu-latest","macos-latest"]'
# If no input is provided, these defaults apply. # If no input is provided, these defaults apply.
@@ -38,7 +41,12 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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 uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
@@ -66,4 +74,4 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }} name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }}
path: ${{ env.ARTIFACT }} path: ${{ env.ARTIFACT }}
+17 -2
View File
@@ -6,6 +6,10 @@
on: on:
workflow_call: workflow_call:
inputs: inputs:
version:
description: 'Version to set for the build'
required: true
type: string
signing: signing:
description: 'Whether to perform signing and notarization' description: 'Whether to perform signing and notarization'
required: false required: false
@@ -69,6 +73,17 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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 - name: Setup Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
@@ -98,13 +113,13 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-cargo-build- ${{ runner.os }}-cargo-build-
# Rest of the workflow remains the same...
- name: Build goosed - name: Build goosed
run: cargo build --release -p goose-server run: cargo build --release -p goose-server
- name: Copy binary into Electron folder - name: Copy binary into Electron folder
run: cp target/release/goosed ui/desktop/src/bin/goosed 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 - name: Add MacOS certs for signing and notarization
if: ${{ inputs.signing }} if: ${{ inputs.signing }}
run: ./add-macos-cert.sh run: ./add-macos-cert.sh
@@ -201,4 +216,4 @@ jobs:
exit 1 exit 1
fi fi
# Kill the app to clean up # Kill the app to clean up
pkill -f "Goose.app/Contents/MacOS/Goose" pkill -f "Goose.app/Contents/MacOS/Goose"
+28 -6
View File
@@ -17,13 +17,33 @@ concurrency:
jobs: jobs:
# ------------------------------------ # ------------------------------------
# 1) Build CLI for multiple OS/Arch # 1) Prepare Version
# ------------------------------------ # ------------------------------------
build-cli: prepare-version:
uses: ./.github/workflows/build-cli.yml 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) Upload Install CLI Script (we only need to do this once) # 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 }}
# ------------------------------------
# 3) Upload Install CLI Script (we only need to do this once)
# ------------------------------------ # ------------------------------------
install-script: install-script:
name: Upload Install Script name: Upload Install Script
@@ -37,11 +57,13 @@ jobs:
path: download_cli.sh 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: bundle-desktop:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop.yml uses: ./.github/workflows/bundle-desktop.yml
with: with:
version: ${{ needs.prepare-version.outputs.version }}
signing: true signing: true
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
@@ -51,7 +73,7 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# ------------------------------------ # ------------------------------------
# 4) Create/Update GitHub Release # 5) Create/Update GitHub Release
# ------------------------------------ # ------------------------------------
release: release:
name: Release name: Release
+31 -13
View File
@@ -7,38 +7,57 @@ on:
- "v1.*" - "v1.*"
name: Release name: Release
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# ------------------------------------ # ------------------------------------
# 1) Build CLI for multiple OS/Arch # 1) Set version variables first
# ------------------------------------ # ------------------------------------
build-cli: prepare-version:
uses: ./.github/workflows/build-cli.yml 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
# ------------------------------------ # ------------------------------------
# 2) Upload Install CLI Script (we only need to do this once) # 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 }}
# ------------------------------------
# 4) Upload Install CLI Script
# ------------------------------------ # ------------------------------------
install-script: install-script:
name: Upload Install Script name: Upload Install Script
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ build-cli ] needs: [build-cli]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: download_cli.sh name: download_cli.sh
path: 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: bundle-desktop:
needs: [prepare-version]
uses: ./.github/workflows/bundle-desktop.yml uses: ./.github/workflows/bundle-desktop.yml
with: with:
version: ${{ needs.prepare-version.outputs.version }}
signing: true signing: true
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
@@ -48,27 +67,25 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# ------------------------------------ # ------------------------------------
# 4) Create/Update GitHub Release # 6) Create/Update GitHub Release
# ------------------------------------ # ------------------------------------
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ build-cli, install-script, bundle-desktop ] needs: [build-cli, install-script, bundle-desktop]
permissions: permissions:
contents: write contents: write
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
merge-multiple: true merge-multiple: true
# Create/update the versioned release # Create/update the versioned release
- name: Release versioned - name: Release versioned
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
# This pattern will match both goose tar.bz2 artifacts and the Goose.zip
artifacts: | artifacts: |
goose-*.tar.bz2 goose-*.tar.bz2
Goose*.zip Goose*.zip
@@ -91,3 +108,4 @@ jobs:
allowUpdates: true allowUpdates: true
omitBody: true omitBody: true
omitPrereleaseDuringUpdate: true omitPrereleaseDuringUpdate: true