diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 9f812d959..8c9b7fe05 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -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. @@ -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 @@ -66,4 +74,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }} - path: ${{ env.ARTIFACT }} + path: ${{ env.ARTIFACT }} \ No newline at end of file diff --git a/.github/workflows/bundle-desktop.yml b/.github/workflows/bundle-desktop.yml index 4dc63cb1a..1e952615f 100644 --- a/.github/workflows/bundle-desktop.yml +++ b/.github/workflows/bundle-desktop.yml @@ -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 @@ -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: @@ -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 @@ -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" \ No newline at end of file diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index ccaf1025d..35b92c4ae 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -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=$(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 @@ -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 }} @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d91bf096f..e37ed690e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} @@ -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 @@ -91,3 +108,4 @@ jobs: allowUpdates: true omitBody: true omitPrereleaseDuringUpdate: true + \ No newline at end of file