OctoBot-Binary-CI #448
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-latest, windows-latest, ubuntu-20.04 ] | |
arch: [ x64, arm64 ] | |
exclude: | |
- os: macos-latest | |
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-20.04' && matrix.arch == 'arm64' | |
uses: uraimo/[email protected] | |
with: | |
arch: aarch64 | |
distro: ubuntu20.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-20.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-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 | |
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-latest' | |
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-20.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 | |
upload-binaries: | |
name: Upload binaries | |
needs: builds | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set version as environement var | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- 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 | |
run: | | |
sha256sum OctoBot_linux_x64 > OctoBot_linux_x64.sha256sum | |
sha256sum OctoBot_linux_arm64 > OctoBot_linux_arm64.sha256sum | |
sha256sum OctoBot_macos_x64 > OctoBot_macos_x64.sha256sum | |
sha256sum OctoBot_windows_x64.exe > OctoBot_windows_x64.exe.sha256sum | |
- name: Upload binary as weekly | |
if: github.event_name == 'schedule' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.S3_REGION_NAME }} | |
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} | |
SOURCE_DIR: $GITHUB_WORKSPACE | |
DEST_DIR: ${{ secrets.WEEKLY_DIR }} | |
- name: Upload binary as latest | |
if: github.event_name != 'schedule' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.S3_REGION_NAME }} | |
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} | |
SOURCE_DIR: $GITHUB_WORKSPACE | |
DEST_DIR: ${{ secrets.LATEST_DIR }} | |
- name: Upload binary as stable | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.S3_REGION_NAME }} | |
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} | |
SOURCE_DIR: $GITHUB_WORKSPACE | |
DEST_DIR: ${{ secrets.STABLE_DIR }} | |
- name: Upload release binary | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.S3_REGION_NAME }} | |
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} | |
SOURCE_DIR: $GITHUB_WORKSPACE | |
DEST_DIR: ${{ steps.vars.outputs.tag }} | |
create-release: | |
name: Create Release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: upload-binaries | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set version as environement var | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- 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 | | |
| ------------- |:-------------:| | |
| Windows x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | | |
| Linux x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | | |
| Linux arm64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | | |
| MacOS x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_macos_x64) | | |
Add .sha256sum to the download url to get each binary checksum | |
notify: | |
name: Notify | |
runs-on: ubuntu-20.04 | |
needs: | |
- builds | |
- upload-binaries | |
if: ${{ failure() }} | |
steps: | |
- name: Notify discord | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
status: Failure | |
webhook: ${{ secrets.DISCORD_GITHUB_WEBHOOK }} |