Skip to content

Weekly Build

Weekly Build #8

Workflow file for this run

name: Weekly Build
on:
schedule:
- cron: '0 0 * * 0' # Runs every Sunday at midnight UTC
workflow_dispatch: # Allows manual triggering
jobs:
set-date:
runs-on: ubuntu-latest
outputs:
date: ${{ steps.set-date.outputs.date }}
steps:
- name: Set date
id: set-date
run: echo "date=$(date +%Y-%m-%d-%H%M)" >> "$GITHUB_OUTPUT"
build-linux:
runs-on: ubuntu-latest
needs: [set-date]
env:
DATE: ${{ needs.set-date.outputs.date }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build the game
run: cargo build --release
- name: Compress build files
run: |
mkdir SBEPIS
cp ./target/release/sbepis SBEPIS/
cp -r ./assets SBEPIS/
tar -czf sbepis-linux-$DATE.tar.gz SBEPIS
- name: Install rclone
run: |
curl https://rclone.org/install.sh | sudo bash
- name: Configure rclone
run: |
mkdir -p ~/.config/rclone
cat <<EOF > ~/.config/rclone/rclone.conf
${{ secrets.RCLONE_CONFIG }}
EOF
- name: Upload build to Google Drive
run: rclone copy sbepis-linux-$DATE.tar.gz "gdrive:SBEPIS Builds"
build-windows:
runs-on: windows-latest
needs: [set-date]
env:
DATE: ${{ needs.set-date.outputs.date }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build the game
run: cargo build --release
- name: Compress build files
run: |
mkdir SBEPIS
cp .\target\release\sbepis.exe SBEPIS\
cp -r .\assets SBEPIS\
Compress-Archive -Path .\SBEPIS -DestinationPath sbepis-windows-$DATE.zip
- name: Install rclone
run: |
choco install rclone
- name: Configure rclone
run: |
$rcloneConfigPath = "$env:USERPROFILE\.config\rclone\rclone.conf"
mkdir -p (Split-Path $rcloneConfigPath)
@"
${{ secrets.RCLONE_CONFIG }}
"@ | Set-Content -Path $rcloneConfigPath
- name: Upload build to Google Drive
run: rclone copy sbepis-windows-$DATE.zip "gdrive:SBEPIS Builds"
notify-discord:
runs-on: ubuntu-latest
needs: [set-date, build-linux, build-windows]
env:
DATE: ${{ needs.set-date.outputs.date }}
steps:
- name: Install rclone
run: |
curl https://rclone.org/install.sh | sudo bash
- name: Configure rclone
run: |
mkdir -p ~/.config/rclone
cat <<EOF > ~/.config/rclone/rclone.conf
${{ secrets.RCLONE_CONFIG }}
EOF
- name: Send Discord notification
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
LINUX_LINK=$(rclone link "gdrive:SBEPIS Builds/sbepis-linux-$DATE.tar.gz")
WINDOWS_LINK=$(rclone link "gdrive:SBEPIS Builds/sbepis-windows-$DATE.zip")
EMBED_CONTENT=$(cat <<EOF
{
"embeds": [
{
"title": "New Builds Available!",
"description": "Build Id: $DATE",
"color": 240116,
"fields": [
{
"name": "Windows",
"value": "[Download]($WINDOWS_LINK)",
"inline": true
},
{
"name": "Linux",
"value": "[Download]($LINUX_LINK)",
"inline": true
}
]
}
]
}
EOF
)
curl -H "Content-Type: application/json" \
-X POST \
-d "$EMBED_CONTENT" \
$DISCORD_WEBHOOK_URL