From fa43189a2d6b2ea79c2b09b3480c721bb7439351 Mon Sep 17 00:00:00 2001 From: Lily Delalande Date: Wed, 29 Jan 2025 14:58:31 -0500 Subject: [PATCH 1/5] process to update version --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d91bf096f..cf35068b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,9 +14,37 @@ concurrency: jobs: # ------------------------------------ + # 1) Update the version + # ------------------------------------ + update-version: + name: Update Cargo.toml & package.json Version + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract version from GitHub release tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Update workspace Cargo.toml version + run: sed -i 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml + + - name: Update package.json version + run: | + npm version $VERSION --no-git-tag-version --allow-same-version + working-directory: ui/desktop + + - name: Commit updated files + run: | + git config --global user.name "github-actions" + git config --global user.email "github-actions@github.com" + git commit -am "Update versions to $VERSION" + git push + # ------------------------------------ # 1) Build CLI for multiple OS/Arch # ------------------------------------ build-cli: + needs: [ update-version ] uses: ./.github/workflows/build-cli.yml # ------------------------------------ From a83010e0f908ebf18d187b97b339b396e366584a Mon Sep 17 00:00:00 2001 From: Lily Delalande Date: Wed, 29 Jan 2025 15:45:28 -0500 Subject: [PATCH 2/5] use version as an input --- .github/workflows/build-cli.yml | 12 +++++- .github/workflows/bundle-desktop.yml | 19 ++++++++- .github/workflows/release.yml | 59 ++++++++++++++++------------ 3 files changed, 61 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 9f812d959..040874680 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 + 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..126a28874 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 Cargo.toml version + sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version}}'"/' Cargo.toml + rm -f Cargo.toml.bak + + # Update package.json version + 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/release.yml b/.github/workflows/release.yml index cf35068b2..e2b40df69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,68 +5,81 @@ on: - 'documentation/**' tags: - "v1.*" - name: Release - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: # ------------------------------------ - # 1) Update the version + # 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 + + # ------------------------------------ + # 2) Update version in files # ------------------------------------ update-version: name: Update Cargo.toml & package.json Version + needs: [prepare-version] runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Extract version from GitHub release tag - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - name: Update workspace Cargo.toml version - run: sed -i 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml - + run: sed -i 's/^version = ".*"/version = "'${{ needs.prepare-version.outputs.version }}'"/' Cargo.toml - name: Update package.json version run: | - npm version $VERSION --no-git-tag-version --allow-same-version + npm version ${{ needs.prepare-version.outputs.version }} --no-git-tag-version --allow-same-version working-directory: ui/desktop - - name: Commit updated files run: | git config --global user.name "github-actions" git config --global user.email "github-actions@github.com" - git commit -am "Update versions to $VERSION" + git commit -am "Update versions to ${{ needs.prepare-version.outputs.version }}" git push + # ------------------------------------ - # 1) Build CLI for multiple OS/Arch + # 3) Build CLI for multiple OS/Arch # ------------------------------------ build-cli: - needs: [ update-version ] + needs: [prepare-version, update-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, update-version] uses: ./.github/workflows/bundle-desktop.yml with: + version: ${{ needs.prepare-version.outputs.version }} signing: true secrets: CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} @@ -76,27 +89,24 @@ 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 @@ -104,7 +114,6 @@ jobs: allowUpdates: true omitBody: true omitPrereleaseDuringUpdate: true - # Create/update the stable release - name: Release stable uses: ncipollo/release-action@v1 @@ -118,4 +127,4 @@ jobs: download_cli.sh allowUpdates: true omitBody: true - omitPrereleaseDuringUpdate: true + omitPrereleaseDuringUpdate: true \ No newline at end of file From 78e8e3b9b3c6bf5c4431e8fee9da42a070ad7686 Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Thu, 30 Jan 2025 10:47:39 -0500 Subject: [PATCH 3/5] feat: substitute version in CLI and Desktop App during release (#925) --- .github/workflows/build-cli.yml | 4 +- .github/workflows/bundle-desktop.yml | 6 +-- .github/workflows/canary.yml | 30 +++++++++++-- .github/workflows/release.yml | 64 +++++++++++----------------- 4 files changed, 55 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 040874680..8c9b7fe05 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -41,9 +41,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Update version + - name: Update version in Cargo.toml run: | - sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version}}'"/' Cargo.toml + sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml rm -f Cargo.toml.bak - name: Setup Rust diff --git a/.github/workflows/bundle-desktop.yml b/.github/workflows/bundle-desktop.yml index 126a28874..1e952615f 100644 --- a/.github/workflows/bundle-desktop.yml +++ b/.github/workflows/bundle-desktop.yml @@ -76,11 +76,11 @@ jobs: # Update versions before build - name: Update versions run: | - # Update Cargo.toml version - sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version}}'"/' Cargo.toml + # Update version in Cargo.toml + sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml rm -f Cargo.toml.bak - # Update package.json version + # Update version in package.json cd ui/desktop npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version 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 e2b40df69..5c97afc75 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: - 'documentation/**' tags: - "v1.*" + - 'test.*' # TODO: remove after testing name: Release concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -23,37 +24,15 @@ jobs: - name: Extract version id: set-version run: | - VERSION=${GITHUB_REF#refs/tags/v} + VERSION=${GITHUB_REF#refs/tags/test.} # TODO: remove after testing + # VERSION=${GITHUB_REF#refs/tags/v} echo "version=$VERSION" >> $GITHUB_OUTPUT - # ------------------------------------ - # 2) Update version in files - # ------------------------------------ - update-version: - name: Update Cargo.toml & package.json Version - needs: [prepare-version] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Update workspace Cargo.toml version - run: sed -i 's/^version = ".*"/version = "'${{ needs.prepare-version.outputs.version }}'"/' Cargo.toml - - name: Update package.json version - run: | - npm version ${{ needs.prepare-version.outputs.version }} --no-git-tag-version --allow-same-version - working-directory: ui/desktop - - name: Commit updated files - run: | - git config --global user.name "github-actions" - git config --global user.email "github-actions@github.com" - git commit -am "Update versions to ${{ needs.prepare-version.outputs.version }}" - git push - # ------------------------------------ # 3) Build CLI for multiple OS/Arch # ------------------------------------ build-cli: - needs: [prepare-version, update-version] + needs: [prepare-version] uses: ./.github/workflows/build-cli.yml with: version: ${{ needs.prepare-version.outputs.version }} @@ -76,7 +55,7 @@ jobs: # 5) Bundle Desktop App (macOS only) # ------------------------------------------------------------ bundle-desktop: - needs: [prepare-version, update-version] + needs: [prepare-version] uses: ./.github/workflows/bundle-desktop.yml with: version: ${{ needs.prepare-version.outputs.version }} @@ -114,17 +93,22 @@ jobs: allowUpdates: true omitBody: true omitPrereleaseDuringUpdate: true - # 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 \ No newline at end of file + prerelease: true # TODO: remove after testing + draft: true # TODO: remove after testing + + # 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 + \ No newline at end of file From 36c7f793e66523da61fd7b93c4ce17c97a0bdf5b Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Thu, 30 Jan 2025 19:05:00 -0500 Subject: [PATCH 4/5] remove TODOs for testing --- .github/workflows/release.yml | 38 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c97afc75..cf8d2769a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: - 'documentation/**' tags: - "v1.*" - - 'test.*' # TODO: remove after testing + name: Release concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -24,8 +24,7 @@ jobs: - name: Extract version id: set-version run: | - VERSION=${GITHUB_REF#refs/tags/test.} # TODO: remove after testing - # VERSION=${GITHUB_REF#refs/tags/v} + VERSION=${GITHUB_REF#refs/tags/v} echo "version=$VERSION" >> $GITHUB_OUTPUT # ------------------------------------ @@ -93,22 +92,21 @@ jobs: allowUpdates: true omitBody: true omitPrereleaseDuringUpdate: true - prerelease: true # TODO: remove after testing - draft: true # TODO: remove after testing + prerelease: true + draft: 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 + # 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 \ No newline at end of file From 6b80189a2b203da09372216dde3d4db75e20898e Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Thu, 30 Jan 2025 19:06:30 -0500 Subject: [PATCH 5/5] remove prerelease, draft --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf8d2769a..e37ed690e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,6 +80,7 @@ jobs: uses: actions/download-artifact@v4 with: merge-multiple: true + # Create/update the versioned release - name: Release versioned uses: ncipollo/release-action@v1 @@ -92,8 +93,6 @@ jobs: allowUpdates: true omitBody: true omitPrereleaseDuringUpdate: true - prerelease: true - draft: true # Create/update the stable release - name: Release stable