Skip to content

Merge pull request #10 from HappyBavarian07/master #59

Merge pull request #10 from HappyBavarian07/master

Merge pull request #10 from HappyBavarian07/master #59

Workflow file for this run

name: Publish
# Controls when the workflow will run
on:
push:
branches:
- 'master'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Determine next tag
id: get_tag
run: |
git fetch --tags
# Get the latest tag in the format r-N
latest_tag=$(git tag | grep -E '^r-[0-9]+$' | sort -V | tail -n 1)
# Extract the numeric part N from r-N
if [[ $latest_tag =~ ^r-([0-9]+)$ ]]; then
latest_number=${BASH_REMATCH[1]}
else
latest_number=0
fi
new_number=$((latest_number + 1))
new_tag="r-${new_number}"
echo "Latest tag: $latest_tag"
echo "New tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Download bob
uses: robinraju/release-downloader@v1
with:
repository: 'swz-git/bob'
latest: true
fileName: 'bob_*_x86_64-unknown-linux-musl.zip'
extract: true
- run: chmod +x bob
# re-assemble bob_build directory from the latest release
- uses: robinraju/release-downloader@v1
id: download_packs
continue-on-error: true
with:
latest: true
fileName: '*.tar.xz'
- uses: robinraju/release-downloader@v1
continue-on-error: true
with:
latest: true
fileName: 'buildinfo.toml'
- uses: robinraju/release-downloader@v1
id: should_rebuild
continue-on-error: true
with:
latest: true
fileName: 'should_rebuild'
- name: Extract archives
if: ${{ steps.download_packs.outcome == 'success' }}
run: |
mkdir -p bob_build
for file in *.tar.xz; do tar --transform 's|^[^/]*|bob_build|' -xf "$file"; done
mv buildinfo.toml bob_build/
- name: Copy old botpack
if: ${{ steps.download_packs.outcome == 'success' }}
run: cp -r bob_build bob_build_old
- name: Split old platforms
if: ${{ steps.download_packs.outcome == 'success' }}
run: ./bob split bob_build_old
- name: Force rebuild by deleting buildinfo
if: ${{ steps.should_rebuild.outcome == 'success' }}
run: find . -name 'buildinfo.toml' -delete
- name: Build
run: ./bob build bob.toml
- name: Split new platforms
run: ./bob split bob_build
- name: Compress full botpack
run: |
tar cf - bob_build_x86_64-windows | xz -9 > botpack_x86_64-windows.tar.xz
tar cf - bob_build_x86_64-linux | xz -9 > botpack_x86_64-linux.tar.xz
- name: Generate platform diffs
if: ${{ steps.download_packs.outcome == 'success' }}
run: |
./bob diff bob_build_old_x86_64-windows bob_build_x86_64-windows > patch_x86_64-windows.bobdiff
./bob diff bob_build_old_x86_64-linux bob_build_x86_64-linux > patch_x86_64-linux.bobdiff
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_tag.outputs.new_tag }}
files: |
botpack_*.tar.xz
patch_*.bobdiff
bob_build/buildinfo.toml
body: 'Pre-built binaries of various bots'