-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename cortex-js folder to platform (#1033)
- Loading branch information
1 parent
c5b4544
commit af43dc0
Showing
230 changed files
with
29 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ name: CI Cortex Release | |
|
||
on: | ||
push: | ||
tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*", "!v[0-9]+.[0-9]+.[0-9]+-cortex-js", "!v[0-9]+.[0-9]+.[0-9]+-[0-9]+-cortex-js"] | ||
paths: ["cortex-cpp/**", "cortex-js/**"] | ||
tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*", "!v[0-9]+.[0-9]+.[0-9]+-platform", "!v[0-9]+.[0-9]+.[0-9]+-[0-9]+-platform"] | ||
paths: ["cortex-cpp/**", "platform/**"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
@@ -223,237 +223,8 @@ jobs: | |
|
||
## cortex-cpp node binding | ||
|
||
build-cortex-single-binary: | ||
runs-on: ${{ matrix.runs-on }} | ||
needs: [create-draft-release, build-and-test] | ||
timeout-minutes: 40 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: "linux" | ||
name: "amd64" | ||
runs-on: "ubuntu-20-04" | ||
|
||
- os: "windows" | ||
name: "amd64" | ||
runs-on: "windows-2019" | ||
|
||
- os: "mac" | ||
name: "amd64" | ||
runs-on: "macos-13" | ||
|
||
- os: "mac" | ||
name: "arm64" | ||
runs-on: "macos-latest" | ||
steps: | ||
- name: Clone | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-dotnet@v3 | ||
if: runner.os == 'Windows' | ||
with: | ||
dotnet-version: "8.0.x" | ||
|
||
- name: Install jq | ||
uses: dcarbone/[email protected] | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: "Update version by tag" | ||
working-directory: cortex-js | ||
shell: bash | ||
run: | | ||
echo "Version: ${{ needs.create-draft-release.outputs.version }}" | ||
# Update the version in package.json | ||
jq --arg version "${{ needs.create-draft-release.outputs.version }}" '.version = $version' package.json > /tmp/package.json | ||
mv /tmp/package.json package.json | ||
- name: Install choco on Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
choco install make -y | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.x" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- run: pip3 install --upgrade setuptools | ||
if: runner.os == 'macOS' | ||
|
||
- run: yarn install && yarn build:binary | ||
working-directory: ./cortex-js | ||
|
||
- name: Get Cer for code signing | ||
if: runner.os == 'macOS' | ||
run: base64 -d <<< "$NOTARIZE_P8_BASE64" > /tmp/notary-key.p8 | ||
shell: bash | ||
env: | ||
NOTARIZE_P8_BASE64: ${{ secrets.NOTARIZE_P8_BASE64 }} | ||
|
||
- uses: apple-actions/import-codesign-certs@v2 | ||
continue-on-error: true | ||
if: runner.os == 'macOS' | ||
with: | ||
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }} | ||
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }} | ||
|
||
- name: update app info | ||
run: | | ||
cd cortex-js | ||
make update-app-info | ||
- name: copy bin file macos | ||
if: runner.os == 'macOS' | ||
run: | | ||
cd cortex-js | ||
mkdir -p installer | ||
which cp | ||
which mv | ||
npm install -g cpx | ||
npx cpx ./dist/cortexso ./ | ||
mv cortexso cortex | ||
- name: Code Signing macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
cd cortex-js | ||
./dist/cortexso --help | ||
echo "--------" | ||
./cortex --help | ||
make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}" | ||
# install quill | ||
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin | ||
# Notarize the binary | ||
quill notarize ./cortex | ||
env: | ||
QUILL_NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }} | ||
QUILL_NOTARY_ISSUER: ${{ secrets.NOTARY_ISSUER }} | ||
QUILL_NOTARY_KEY: "/tmp/notary-key.p8" | ||
|
||
- name: Create MacOS PKG Installer | ||
if: runner.os == 'macOS' | ||
run: | | ||
cd cortex-js | ||
echo "--------" | ||
npx cpx ./cortex ./installer | ||
./installer/cortex --help | ||
pkgbuild --identifier ai.cortex.pkg --install-location ./usr/local/bin/ --root ./installer cortex-installer.pkg | ||
make codesign-installer CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}" | ||
# Notary the installer | ||
xcrun notarytool submit cortex-installer.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait | ||
- name: Create Linux DEB Installer | ||
if: runner.os == 'Linux' | ||
run: | | ||
cd cortex-js | ||
mkdir -p cortexso/DEBIAN | ||
mkdir -p cortexso/usr/local/bin | ||
sed "s/Version:/Version: ${{ needs.create-draft-release.outputs.version }}/g" control.template > cortexso/DEBIAN/control | ||
cp cortex cortexso/usr/local/bin/cortex | ||
dpkg-deb --build cortexso | ||
- run: | | ||
cd cortex-js | ||
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools | ||
make codesign-binary CODE_SIGN=true CORTEX_VERSION="0.${{ needs.create-draft-release.outputs.version }}" AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}" | ||
name: Code Signing Windows | ||
shell: cmd | ||
if: runner.os == 'Windows' | ||
- name: Update version in installer.iss using sed | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
cd cortex-js | ||
sed -i "s/AppVersion=1.0/AppVersion=${{ needs.create-draft-release.outputs.version }}/g" installer.iss | ||
cat installer.iss | ||
- name: Compile .ISS to .EXE Installer | ||
uses: Minionguyjpro/[email protected] | ||
if: runner.os == 'Windows' | ||
with: | ||
path: cortex-js/installer.iss | ||
options: /O+ | ||
|
||
- run: | | ||
cd cortex-js | ||
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools | ||
make codesign-installer CODE_SIGN=true CORTEX_VERSION="0.${{ needs.create-draft-release.outputs.version }}" AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}" | ||
name: Code Signing Windows | ||
shell: cmd | ||
if: runner.os == 'Windows' | ||
- name: Post-Bundle | ||
run: | | ||
cd cortex-js | ||
make postbundle | ||
- name: Upload Cortex Installer | ||
uses: actions/[email protected] | ||
if: runner.os != 'Linux' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | ||
asset_path: ./cortex-js/cortex-installer.tar.gz | ||
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- name: Upload Cortex Installer | ||
uses: actions/[email protected] | ||
if: runner.os == 'Windows' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | ||
asset_path: ./cortex-js/setup.exe | ||
asset_name: cortex-installer-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | ||
asset_path: ./cortex-js/cortex.tar.gz | ||
asset_name: cortex-${{ needs.create-draft-release.outputs.version }}-${{ matrix.name }}-${{ matrix.os }}.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- uses: actions/[email protected] | ||
if: runner.os == 'Linux' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | ||
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] | ||
needs: [build-and-test] | ||
permissions: | ||
# write permission is required to create a github release | ||
contents: write | ||
|
@@ -476,59 +247,4 @@ jobs: | |
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="cortex update to version ${{ needs.create-draft-release.outputs.version }}" | ||
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 pbuilder build ../cortexso_${{ needs.create-draft-release.outputs.version }}.dsc | ||
dput ppa:homebrew-computer/main ../cortexso_${{ needs.create-draft-release.outputs.version }}_source.changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.