ci: update release processes using Justfile, make reusable workflows have optional version param (#972)
This commit is contained in:
@@ -6,7 +6,8 @@ on:
|
|||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
required: true
|
required: false
|
||||||
|
default: ""
|
||||||
type: string
|
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"]'
|
||||||
@@ -42,6 +43,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update version in Cargo.toml
|
- name: Update version in Cargo.toml
|
||||||
|
if: ${{ inputs.version != '' }}
|
||||||
run: |
|
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
|
rm -f Cargo.toml.bak
|
||||||
@@ -74,4 +76,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 }}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Version to set for the build'
|
description: 'Version to set for the build'
|
||||||
required: true
|
required: false
|
||||||
|
default: ""
|
||||||
type: string
|
type: string
|
||||||
signing:
|
signing:
|
||||||
description: 'Whether to perform signing and notarization'
|
description: 'Whether to perform signing and notarization'
|
||||||
@@ -75,6 +76,7 @@ jobs:
|
|||||||
|
|
||||||
# Update versions before build
|
# Update versions before build
|
||||||
- name: Update versions
|
- name: Update versions
|
||||||
|
if: ${{ inputs.version != '' }}
|
||||||
run: |
|
run: |
|
||||||
# Update version in Cargo.toml
|
# Update version in Cargo.toml
|
||||||
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml
|
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'documentation/**'
|
- "documentation/**"
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
@@ -28,9 +28,10 @@ jobs:
|
|||||||
- name: Generate a canary version
|
- name: Generate a canary version
|
||||||
id: set-version
|
id: set-version
|
||||||
run: |
|
run: |
|
||||||
# TODO: fix this to be dynamic - extract version from repo
|
# Extract the version from Cargo.toml
|
||||||
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
||||||
VERSION="1.0.3-canary+${SHORT_SHA}"
|
VERSION=$(grep '^version\s*=' Cargo.toml | head -n 1 | cut -d\" -f2)
|
||||||
|
VERSION="${VERSION}-canary+${SHORT_SHA}"
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
@@ -48,7 +49,7 @@ jobs:
|
|||||||
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
|
||||||
@@ -71,14 +72,14 @@ jobs:
|
|||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
# 5) Create/Update GitHub Release
|
# 5) 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
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'documentation/**'
|
- "documentation/**"
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'documentation/**'
|
- "documentation/**"
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: "lts/*"
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -104,5 +104,4 @@ jobs:
|
|||||||
uses: ./.github/workflows/bundle-desktop.yml
|
uses: ./.github/workflows/bundle-desktop.yml
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
with:
|
with:
|
||||||
version: 1.0.3 # TODO: fix this to be dynamic
|
|
||||||
signing: false
|
signing: false
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ jobs:
|
|||||||
if: ${{ needs.trigger-on-command.outputs.continue == 'true' }}
|
if: ${{ needs.trigger-on-command.outputs.continue == 'true' }}
|
||||||
uses: ./.github/workflows/bundle-desktop.yml
|
uses: ./.github/workflows/bundle-desktop.yml
|
||||||
with:
|
with:
|
||||||
version: 1.0.3 # TODO: fix this to be dynamic
|
|
||||||
signing: true
|
signing: true
|
||||||
secrets:
|
secrets:
|
||||||
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
|
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
|
||||||
@@ -71,11 +70,11 @@ jobs:
|
|||||||
issue-number: ${{ needs.trigger-on-command.outputs.pr_number }}
|
issue-number: ${{ needs.trigger-on-command.outputs.pr_number }}
|
||||||
body: |
|
body: |
|
||||||
### Desktop App for this PR
|
### Desktop App for this PR
|
||||||
|
|
||||||
The following build is available for testing:
|
The following build is available for testing:
|
||||||
|
|
||||||
- [📱 macOS Desktop App (arm64, signed)](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/Goose-darwin-arm64.zip)
|
- [📱 macOS Desktop App (arm64, signed)](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/Goose-darwin-arm64.zip)
|
||||||
|
|
||||||
After downloading, unzip the file and drag the Goose.app to your Applications folder. The app is signed and notarized for macOS.
|
After downloading, unzip the file and drag the Goose.app to your Applications folder. The app is signed and notarized for macOS.
|
||||||
|
|
||||||
This link is provided by nightly.link and will work even if you're not logged into GitHub.
|
This link is provided by nightly.link and will work even if you're not logged into GitHub.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'documentation/**'
|
- "documentation/**"
|
||||||
tags:
|
tags:
|
||||||
- "v1.*"
|
- "v1.*"
|
||||||
|
|
||||||
@@ -13,31 +13,13 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
# 1) Set version variables first
|
# 1) Build CLI for multiple OS/Arch
|
||||||
# ------------------------------------
|
|
||||||
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:
|
build-cli:
|
||||||
needs: [prepare-version]
|
|
||||||
uses: ./.github/workflows/build-cli.yml
|
uses: ./.github/workflows/build-cli.yml
|
||||||
with:
|
|
||||||
version: ${{ needs.prepare-version.outputs.version }}
|
|
||||||
|
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
# 4) Upload Install CLI Script
|
# 2) Upload Install CLI Script
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
install-script:
|
install-script:
|
||||||
name: Upload Install Script
|
name: Upload Install Script
|
||||||
@@ -51,13 +33,11 @@ jobs:
|
|||||||
path: download_cli.sh
|
path: download_cli.sh
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# 5) Bundle Desktop App (macOS only)
|
# 3) 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 }}
|
||||||
@@ -67,7 +47,7 @@ jobs:
|
|||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
# 6) Create/Update GitHub Release
|
# 4) Create/Update GitHub Release
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
@@ -80,7 +60,7 @@ jobs:
|
|||||||
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
|
||||||
@@ -108,4 +88,3 @@ jobs:
|
|||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
omitBody: true
|
omitBody: true
|
||||||
omitPrereleaseDuringUpdate: true
|
omitPrereleaseDuringUpdate: true
|
||||||
|
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
# Justfile
|
# Justfile
|
||||||
|
|
||||||
|
# list all tasks
|
||||||
|
default:
|
||||||
|
@just --list
|
||||||
|
|
||||||
# Default release command
|
# Default release command
|
||||||
release:
|
release-binary:
|
||||||
@echo "Building release version..."
|
@echo "Building release version..."
|
||||||
cargo build --release
|
cargo build --release
|
||||||
@just copy-binary
|
@just copy-binary
|
||||||
@@ -18,7 +22,7 @@ copy-binary:
|
|||||||
|
|
||||||
# Run UI with latest
|
# Run UI with latest
|
||||||
run-ui:
|
run-ui:
|
||||||
@just release
|
@just release-binary
|
||||||
@echo "Running UI..."
|
@echo "Running UI..."
|
||||||
cd ui/desktop && npm install && npm run start-gui
|
cd ui/desktop && npm install && npm run start-gui
|
||||||
|
|
||||||
@@ -34,10 +38,65 @@ run-server:
|
|||||||
|
|
||||||
# make GUI with latest binary
|
# make GUI with latest binary
|
||||||
make-ui:
|
make-ui:
|
||||||
@just release
|
@just release-binary
|
||||||
cd ui/desktop && npm run bundle:default
|
cd ui/desktop && npm run bundle:default
|
||||||
|
|
||||||
# Setup langfuse server
|
# Setup langfuse server
|
||||||
langfuse-server:
|
langfuse-server:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
./scripts/setup_langfuse.sh
|
./scripts/setup_langfuse.sh
|
||||||
|
|
||||||
|
# ensure the current branch is "main" or error
|
||||||
|
ensure-main:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
branch=$(git rev-parse --abbrev-ref HEAD); \
|
||||||
|
if [ "$branch" != "main" ]; then \
|
||||||
|
echo "Error: You are not on the main branch (current: $branch)"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# validate the version is semver, and not the current version
|
||||||
|
validate version:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
if [[ ! "{{ version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
|
||||||
|
echo "[error]: invalid version '{{ version }}'."
|
||||||
|
echo " expected: semver format major.minor.patch or major.minor.patch-<suffix>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_version=$(just get-tag-version)
|
||||||
|
if [[ "{{ version }}" == "$current_version" ]]; then
|
||||||
|
echo "[error]: current_version '$current_version' is the same as target version '{{ version }}'"
|
||||||
|
echo " expected: new version in semver format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set cargo and app versions, must be semver
|
||||||
|
release version: ensure-main
|
||||||
|
@just validate {{ version }} || exit 1
|
||||||
|
|
||||||
|
@git switch -c "release/{{ version }}"
|
||||||
|
@uvx --from=toml-cli toml set --toml-path=Cargo.toml "workspace.package.version" {{ version }}
|
||||||
|
|
||||||
|
@cd ui/desktop && npm version {{ version }} --no-git-tag-version --allow-same-version
|
||||||
|
|
||||||
|
@git add Cargo.toml ui/desktop/package.json ui/desktop/package-lock.json
|
||||||
|
@git commit --message "chore(release): release version {{ version }}"
|
||||||
|
|
||||||
|
# extract version from Cargo.toml
|
||||||
|
get-tag-version:
|
||||||
|
@uvx --from=toml-cli toml get --toml-path=Cargo.toml "workspace.package.version"
|
||||||
|
|
||||||
|
# create the git tag from Cargo.toml, must be on main
|
||||||
|
tag: ensure-main
|
||||||
|
echo git tag v$(just get-tag-version)
|
||||||
|
|
||||||
|
# create tag and push to origin (use this when release branch is merged to main)
|
||||||
|
tag-push: tag
|
||||||
|
# this will kick of ci for release
|
||||||
|
echo git push origin tag v$(just get-tag-version)
|
||||||
|
|
||||||
|
# generate release notes from git commits
|
||||||
|
release-notes:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
git log --pretty=format:"- %s" v$(just get-tag-version)..HEAD
|
||||||
|
|||||||
Reference in New Issue
Block a user