Skip to content

Run Deploy

Run Deploy #117

Workflow file for this run

name: Run Deploy
on:
workflow_dispatch:
inputs:
version:
description: New Version
default: ""
required: true
publish:
description: Make Public(true or false)
default: "false"
required: true
jobs:
RunDeploy:
runs-on: windows-2022
steps:
# check users permission
- name: "Check Permissions"
uses: "lannonbr/repo-permission-check-action@2.0.0"
with:
permission: "admin"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Install Dependencies
- name: Clone Repository
uses: actions/checkout@v2
- name: Install Python Deploy Tools
run: |
python -m pip install wheel
python -m pip install twine
python -m pip install awscli
shell: cmd
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Typescript
run: |
npm install -g ts-node
shell: cmd
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0.3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Print Inputs
run: |
echo ${{ github.event.inputs.version }}
echo ${{ github.event.inputs.publish }}
- name: Compile x64
run: |
mkdir %GITHUB_WORKSPACE%\build64
cd %GITHUB_WORKSPACE%\build64
cmake -DBRAINFLOW_VERSION=%GITHUB_SHA% -DWARNINGS_AS_ERRORS=ON -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=8.1 -DCMAKE_INSTALL_PREFIX=..\installed64\ ..
cmake --build . --target install --config Release -j 2 --parallel 2
shell: cmd
# Download all artifacts from AWS
- name: Download Linux Libs
run: |
New-Item $env:GITHUB_WORKSPACE\linux -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/linux/ $env:GITHUB_WORKSPACE\linux\ --recursive
ls $env:GITHUB_WORKSPACE\linux\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download MacOS Libs
run: |
New-Item $env:GITHUB_WORKSPACE\macos -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/macos_release/ $env:GITHUB_WORKSPACE\macos\ --recursive
ls $env:GITHUB_WORKSPACE\macos\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download Win x64 Libs
run: |
New-Item $env:GITHUB_WORKSPACE\win64 -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/win64/lib/ $env:GITHUB_WORKSPACE\win64\ --recursive
ls $env:GITHUB_WORKSPACE\win64\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download Win x32 Libs
run: |
New-Item $env:GITHUB_WORKSPACE\win32 -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/win32/lib/ $env:GITHUB_WORKSPACE\win32\ --recursive
ls $env:GITHUB_WORKSPACE\win32\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
# Prepare packages
- name: Prepare Libs
run: |
New-Item $env:GITHUB_WORKSPACE\compiled_libs -itemtype directory
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\compiled_libs
Compress-7Zip -Path $env:GITHUB_WORKSPACE\compiled_libs -ArchiveFileName $env:GITHUB_WORKSPACE\compiled_libs.tar -Format Tar
aws s3 cp $env:GITHUB_WORKSPACE\compiled_libs.tar s3://brainflow/$env:GITHUB_SHA/compiled_libs.tar
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Prepare Node Package
run: |
cd $env:GITHUB_WORKSPACE\nodejs_package\
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib
(gc .\package.json).replace('0.0.0-development', $env:VERSION) | Out-File -encoding ASCII package.json
type package.json
npm install
npm run build
npm pack
aws s3 cp $env:GITHUB_WORKSPACE\nodejs_package\ s3://brainflow/$env:GITHUB_SHA/npm --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Java Package
run: |
cd $env:GITHUB_WORKSPACE\java_package\brainflow
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources
(gc .\pom.xml).replace('0.0.1-SNAPSHOT', $env:VERSION) | Out-File -encoding ASCII pom.xml
type pom.xml
(gc .\settings.xml).replace('USER',$env:PUBLISH_USER) | Out-File -encoding ASCII settings.xml
(gc .\settings.xml).replace('TOKEN',$env:PUBLISH_TOKEN) | Out-File -encoding ASCII settings.xml
mvn package
aws s3 cp $env:GITHUB_WORKSPACE\java_package\brainflow\target\ s3://brainflow/$env:GITHUB_SHA/jars --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Python Package
run: |
cd $env:GITHUB_WORKSPACE\python_package\
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\python_package\brainflow\lib
(gc .\setup.py).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII setup.py
type setup.py
python setup.py sdist bdist_wheel
aws s3 cp $env:GITHUB_WORKSPACE\python_package\ s3://brainflow/$env:GITHUB_SHA/whl --recursive
env:
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Rust Package
run: |
cd $env:GITHUB_WORKSPACE\rust_package\brainflow
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\rust_package\brainflow\lib
(gc .\Cargo.toml).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII Cargo.toml
type Cargo.toml
cargo login $env:CARGO_TOKEN
# cargo publish --dry-run --allow-dirty
# aws s3 cp $env:GITHUB_WORKSPACE\rust_package\brainflow s3://brainflow/$env:GITHUB_SHA/rust --recursive
env:
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Nuget Package
run: |
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" *.a | foreach { Remove-Item -Path $_.FullName }
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" *.lib | foreach { Remove-Item -Path $_.FullName }
ls $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib
cd $env:GITHUB_WORKSPACE\csharp_package\brainflow
dotnet restore brainflow.sln
msbuild brainflow.sln /p:Configuration=Release /p:Platform="Any CPU"
cd $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow
(gc .\brainflow.csproj).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII brainflow.csproj
type brainflow.csproj
dotnet pack brainflow.csproj -c Release
aws s3 cp $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow s3://brainflow/$env:GITHUB_SHA/nuget --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
NUGET_ENABLE_LEGACY_CSPROJ_PACK: true
- name: Prepare Matlab Package
run: |
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\matlab_package\brainflow\lib
Compress-7Zip -Path $env:GITHUB_WORKSPACE\matlab_package -ArchiveFileName $env:GITHUB_WORKSPACE\matlab_package.tar -Format Tar
aws s3 cp $env:GITHUB_WORKSPACE\matlab_package.tar s3://brainflow/$env:GITHUB_SHA/matlab_package.tar
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
# publish packages
- name: Publish Packages
if: github.event.inputs.publish == 'true'
run: |
cd $env:GITHUB_WORKSPACE\nodejs_package
echo "//registry.npmjs.org/:_authToken=$env:NPM_TOKEN" > .npmrc
npm publish
cd $env:GITHUB_WORKSPACE\java_package\brainflow
mvn -s $env:GITHUB_WORKSPACE\java_package\brainflow\settings.xml deploy -Dregistry=https://maven.pkg.github.com/brainflow-dev -Dtoken=$env:PUBLISH_TOKEN
cd $env:GITHUB_WORKSPACE\python_package
twine upload --skip-existing dist/*.whl --user Andrey1994 --password $env:PYPI_PASSWORD
cd $env:GITHUB_WORKSPACE\rust_package\brainflow
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
# create java package for java 8, will be removed
- name: Java 8 package
run: |
cd $env:GITHUB_WORKSPACE\java_package\brainflow
(gc .\pom.xml).replace('<source>11</source>', '<source>1.8</source>') | Out-File -encoding ASCII pom.xml
(gc .\pom.xml).replace('<target>11</target>', '<target>1.8</target>') | Out-File -encoding ASCII pom.xml
type pom.xml
mvn clean
Remove-Item "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\java\module-info.java"
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources
mvn package
aws s3 cp $env:GITHUB_WORKSPACE\java_package\brainflow\target\ s3://brainflow/$env:GITHUB_SHA/jars_java8 --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}