Skip to content

Commit

Permalink
Feat cortex publish launchpad (#910)
Browse files Browse the repository at this point in the history
Co-authored-by: Hien To <[email protected]>
  • Loading branch information
hiento09 and hiento09 authored Jul 25, 2024
1 parent 28f416d commit 8125c6a
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 1 deletion.
66 changes: 65 additions & 1 deletion .github/workflows/cortex-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI Cortex Release

on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*"]
paths: ["cortex-cpp/**", "cortex-js/**"]
workflow_dispatch:

Expand Down Expand Up @@ -416,6 +416,14 @@ jobs:
asset_path: ./cortex-js/cortexso.deb
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.deb
asset_content_type: application/gzip

# Upload artifact for package manager
- name: Upload Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: cortex-linux
path: ./cortex-js/cortex

update_release_draft:
needs: [build-and-test, build-cortex-single-binary]
Expand All @@ -440,3 +448,59 @@ jobs:
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


# Add jobs with approval
public_package_manager:
needs: [create-draft-release, update_release_draft]
runs-on: ubuntu-latest
environment: package-manager
permissions:
contents: read
steps:
- name: checkout
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v2
with:
name: cortex-linux
path: ./cortex-linux

- name: install dependencies
run: |
ls -al ./cortex-linux
sudo apt-get install dput devscripts build-essential debhelper-compat pbuilder debootstrap devscripts -y
- name: import gpg key with subkey
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.HOMEBREW_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.HOMEBREW_GPG_PASSPHRASE }}
fingerprint: ${{ secrets.HOMEBREW_GPG_FINGERPRINT }}

- run: |
mkdir -p package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian
cp package-managers-template/launchpad/cortexso/debian/* package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/
cp ./cortex-linux/cortex package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/
- name: Get release notes
id: release_notes
run: |
RELEASE_NOTES=$(curl -s -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/tags/${VERSION} | jq -r '.body')
echo "RELEASE_NOTES=${RELEASE_NOTES}" >> $GITHUB_ENV
- name: Update change log
run: |
sed -i "s/VERSION/${{ needs.create-draft-release.outputs.version }}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
sed -i "s/CHANGELOG_HERE/${{ env.RELEASE_NOTES }}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
timestamp=$(date -u +"%a, %d %b %Y %H:%M:%S +0000")
sed -i "s/TIME_HERE/${timestamp}/g" package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}/debian/changelog
- name: Build package
run: |
cd package-managers-template/launchpad/cortexso-${{ needs.create-draft-release.outputs.version }}
echo "y" | debuild -S -sa -k${{ secrets.HOMEBREW_GPG_FINGERPRINT }}
sudo pbuilder create --distribution jammy --debootstrapopts --variant=buildd
sudo sudo pbuilder build ../cortexso_${{ needs.create-draft-release.outputs.version }}.dsc
dput ppa:cortexlabs/cortex cortexso_${{ needs.create-draft-release.outputs.version }}_source.changes
11 changes: 11 additions & 0 deletions package-managers-template/launchpad/cortexso/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cortexso (VERSION) jammy; urgency=low

CHANGELOG_HERE

-- Homebrew Computer Pte Ltd <[email protected]> TIME_HERE

cortexso (VERSION) noble; urgency=low

CHANGELOG_HERE

-- Homebrew Computer Pte Ltd <[email protected]> TIME_HERE
12 changes: 12 additions & 0 deletions package-managers-template/launchpad/cortexso/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: cortexso
Section: base
Priority: optional
Maintainer: Homebrew Computer Pte Ltd <[email protected]>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.6.2

Package: cortexso
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, openmpi-bin, libopenmpi-dev
Description: Cortex
Cortex is an OpenAI-compatible AI engine that developers can use to build LLM apps. It is packaged with a Docker-inspired command-line interface and client libraries. It can be used as a standalone server or imported as a library.
19 changes: 19 additions & 0 deletions package-managers-template/launchpad/cortexso/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cortexso
Source: https://cortex.so

Files: *
Copyright: 2023, Homebrew Computer Pte Ltd <[email protected]>
License: AGPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cortex /usr/bin/
7 changes: 7 additions & 0 deletions package-managers-template/launchpad/cortexso/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:
dh_install
override_dh_strip:
dh_strip --exclude=cortex

0 comments on commit 8125c6a

Please sign in to comment.