OctoBot-Binary-CI #523
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
name: OctoBot-Binary-CI | |
on: | |
schedule: | |
- cron: '0 5 * * 1' # every monday at 5am | |
push: | |
jobs: | |
builds: | |
name: ${{ matrix.os }} - ${{ matrix.arch }} - Python 3.10 - build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ macos-13, windows-latest, ubuntu-22.04 ] | |
arch: [ x64, arm64 ] | |
exclude: | |
- os: macos-13 | |
arch: arm64 | |
- os: windows-latest | |
arch: arm64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.x' | |
architecture: x64 | |
- name: Build OctoBot Binary on Linux arm64 | |
if: matrix.os == 'ubuntu-22.04' && matrix.arch == 'arm64' | |
uses: uraimo/[email protected] | |
with: | |
arch: aarch64 | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
env: | | |
GH_REPO: Drakkar-Software/OctoBot-Tentacles | |
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git | |
OCTOBOT_DEFAULT_BRANCH: dev | |
OCTOBOT_REPOSITORY_DIR: OctoBot | |
NLTK_DATA: nltk_data | |
BUILD_ARCH: ${{ matrix.arch }} | |
run: | | |
apt-get update | |
apt-get install -y --no-install-recommends python3.10 python3-pip python3-dev git gcc musl-dev libc-dev build-essential zlib1g zlib1g-dev | |
bash ./build_scripts/unix.sh | |
- name: Build OctoBot Binary on Linux | |
if: matrix.os == 'ubuntu-22.04' && matrix.arch == 'x64' | |
env: | |
GH_REPO: Drakkar-Software/OctoBot-Tentacles | |
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git | |
OCTOBOT_DEFAULT_BRANCH: dev | |
OCTOBOT_REPOSITORY_DIR: OctoBot | |
NLTK_DATA: nltk_data | |
BUILD_ARCH: ${{ matrix.arch }} | |
run: bash ./build_scripts/unix.sh | |
- name: Build OctoBot Binary on MacOS | |
if: matrix.os == 'macos-13' | |
env: | |
GH_REPO: Drakkar-Software/OctoBot-Tentacles | |
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git | |
OCTOBOT_DEFAULT_BRANCH: dev | |
OCTOBOT_REPOSITORY_DIR: OctoBot | |
NLTK_DATA: nltk_data | |
BUILD_ARCH: ${{ matrix.arch }} | |
run: bash ./build_scripts/unix.sh | |
- name: Build OctoBot Binary on Windows | |
if: matrix.os == 'windows-latest' | |
env: | |
GH_REPO: Drakkar-Software/OctoBot-Tentacles | |
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git | |
OCTOBOT_DEFAULT_BRANCH: dev | |
OCTOBOT_REPOSITORY_DIR: OctoBot | |
NLTK_DATA: nltk_data | |
run: .\build_scripts\windows.ps1 | |
shell: powershell | |
- name: Upload OctoBot Binary on MacOS | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'macos-13' | |
with: | |
name: OctoBot_macos_${{ matrix.arch }} | |
path: OctoBot/OctoBot_${{ matrix.arch }} | |
if-no-files-found: error | |
- name: Upload OctoBot Binary on Linux | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'ubuntu-22.04' | |
with: | |
name: OctoBot_linux_${{ matrix.arch }} | |
path: OctoBot/OctoBot_${{ matrix.arch }} | |
if-no-files-found: error | |
- name: Upload OctoBot Binary on Windows | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: OctoBot_windows_${{ matrix.arch }}.exe | |
path: OctoBot/dist/OctoBot_windows.exe | |
if-no-files-found: error | |
create-release: | |
name: Create Release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: builds | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Set version as environement var | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Clean artifact names | |
run: | | |
sudo apt-get update | |
sudo apt-get install rename -y | |
find . -type f -exec bash -c 'mv $1 $(basename $(dirname $1)).tmp && rm -rf $(basename $(dirname $1)) && rename 's/\.tmp$//' *.tmp' _ {} \; | |
- name: Compute hashes | |
id: hashes | |
run: | | |
echo ::set-output name=octobot_linux_x64_hash::$(openssl sha256 ./OctoBot_linux_x64 | awk '{print $2}') | |
echo ::set-output name=octobot_linux_arm64_hash::$(openssl sha256 ./OctoBot_linux_arm64 | awk '{print $2}') | |
echo ::set-output name=octobot_macos_x64_hash::$(openssl sha256 ./OctoBot_macos_x64 | awk '{print $2}') | |
echo ::set-output name=octobot_windows_x64_hash::$(openssl sha256 ./OctoBot_windows_x64.exe | awk '{print $2}') | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
with: | |
tag_name: ${{ steps.vars.outputs.tag }} | |
release_name: Release - ${{ steps.vars.outputs.tag }} | |
owner: ${{ github.repository_owner }} | |
repo: OctoBot | |
draft: true | |
prerelease: false | |
commitish: master | |
body: | | |
| Binary | Download link | SHA256 | | |
| ------------- |:-------------:|:-------------:| | |
| Windows x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | ${{ steps.hashes.outputs.octobot_windows_x64_hash }} | | |
| Linux x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | ${{ steps.hashes.outputs.octobot_linux_x64_hash }} | | |
| Linux arm64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | ${{ steps.hashes.outputs.octobot_linux_arm64_hash }} | | |
| MacOS x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_macos_x64) | ${{ steps.hashes.outputs.octobot_macos_x64_hash }} | | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./OctoBot_windows_x64.exe | |
asset_name: OctoBot_windows_x64.exe | |
asset_content_type: application/x-binary | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./OctoBot_linux_x64 | |
asset_name: OctoBot_linux_x64 | |
asset_content_type: application/x-binary | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./OctoBot_linux_arm64 | |
asset_name: OctoBot_linux_arm64 | |
asset_content_type: application/x-binary | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./OctoBot_macos_x64 | |
asset_name: OctoBot_macos_x64 | |
asset_content_type: application/x-binary | |
notify: | |
name: Notify | |
runs-on: ubuntu-22.04 | |
needs: | |
- builds | |
- create-release | |
if: ${{ failure() }} | |
steps: | |
- name: Notify discord | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
status: Failure | |
webhook: ${{ secrets.DISCORD_GITHUB_WEBHOOK }} |