ci: publish GDK packages from version tags (#11595)
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
name: Publish GDK
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "gdk-v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: GDK version to publish (for example, 0.1.0-alpha.6)
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: gdk-release-${{ github.event_name == 'workflow_dispatch' && format('gdk-v{0}', inputs.version) || github.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
validate-version:
|
||||
name: Validate package versions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.value }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Resolve release version
|
||||
id: version
|
||||
shell: bash
|
||||
env:
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
run: echo "value=${INPUT_VERSION:-${GITHUB_REF_NAME#gdk-v}}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install just
|
||||
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
|
||||
|
||||
- name: Validate package versions
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.version.outputs.value }}
|
||||
run: just --justfile crates/goose-sdk/justfile check-version "$RELEASE_VERSION"
|
||||
|
||||
crates-io:
|
||||
name: Publish Rust crates
|
||||
needs: validate-version
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
runs-on: ubuntu-latest
|
||||
environment: crates-io
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
|
||||
with:
|
||||
cache: false
|
||||
|
||||
- name: Install just
|
||||
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4
|
||||
|
||||
- name: Authenticate with crates.io
|
||||
id: crates-io-auth
|
||||
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
|
||||
|
||||
- name: Publish to crates.io
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
|
||||
run: just --justfile crates/goose-sdk/justfile crates-publish false
|
||||
|
||||
maven-central:
|
||||
name: Publish Maven package
|
||||
needs: validate-version
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/maven-sdk.yml
|
||||
with:
|
||||
publish: true
|
||||
secrets: inherit
|
||||
|
||||
pypi:
|
||||
name: Publish Python wheels
|
||||
needs: validate-version
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
uses: ./.github/workflows/python-sdk-wheels.yml
|
||||
with:
|
||||
publish: true
|
||||
@@ -1,6 +1,13 @@
|
||||
name: Maven GDK
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
publish:
|
||||
description: "Publish gdk to Maven Central after building"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish:
|
||||
@@ -73,6 +80,8 @@ jobs:
|
||||
name: Package Maven artifact
|
||||
needs: build-native
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.value }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
@@ -112,12 +121,20 @@ jobs:
|
||||
working-directory: crates/goose-sdk/maven
|
||||
run: gradle --no-daemon publishToMavenLocal
|
||||
|
||||
- name: Stage Maven local artifacts
|
||||
- name: Resolve Maven version
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
version=$(grep -m1 '^version =' crates/goose-sdk/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
|
||||
echo "value=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Stage Maven local artifacts
|
||||
shell: bash
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.value }}
|
||||
run: |
|
||||
mkdir -p maven-artifacts
|
||||
cp -R "$HOME/.m2/repository/io/github/aaif-goose/gdk/$version" maven-artifacts/
|
||||
cp -R "$HOME/.m2/repository/io/github/aaif-goose/gdk/$VERSION" maven-artifacts/
|
||||
|
||||
- name: Upload Maven artifact bundle
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
@@ -175,8 +192,11 @@ jobs:
|
||||
name: Publish to Maven Central
|
||||
needs: [package, smoke-test-linux-aarch64]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.publish
|
||||
if: inputs.publish
|
||||
environment: maven-central
|
||||
concurrency:
|
||||
group: gdk-maven-release-${{ needs.package.outputs.version }}
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
name: Python GDK Wheels
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
publish:
|
||||
description: "Publish wheels to PyPI after building"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish:
|
||||
@@ -25,7 +32,7 @@ jobs:
|
||||
- name: macos-arm64
|
||||
os: macos-14
|
||||
- name: macos-x86_64
|
||||
os: macos-13
|
||||
os: macos-15-intel
|
||||
- name: linux-x86_64
|
||||
os: ubuntu-latest
|
||||
container: quay.io/pypa/manylinux_2_28_x86_64@sha256:441c35fdc6ee809ff9260894f8468ab4fea8c15dc880f8700a3f81b7922c1cda
|
||||
@@ -39,7 +46,12 @@ jobs:
|
||||
- name: Set up Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
|
||||
|
||||
- name: Select Linux Python
|
||||
if: runner.os == 'Linux'
|
||||
run: echo "/opt/python/cp312-cp312/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Set up Python
|
||||
if: runner.os != 'Linux'
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
@@ -99,7 +111,7 @@ jobs:
|
||||
name: Publish wheels to PyPI
|
||||
needs: build-wheels
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.publish
|
||||
if: inputs.publish
|
||||
environment: pypi
|
||||
steps:
|
||||
- name: Download wheel artifacts
|
||||
@@ -113,3 +125,4 @@ jobs:
|
||||
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
||||
with:
|
||||
packages-dir: dist
|
||||
skip-existing: true
|
||||
|
||||
Reference in New Issue
Block a user