Beef-Nightly/.forgejo/workflows/build.yml

114 lines
3 KiB
YAML

on:
workflow_dispatch:
schedule:
- cron: '0 12 * * *'
jobs:
Build:
steps:
- name: Install apt packages
run: |
apt update
apt install git cmake software-properties-common --yes
- name: Add llvm package
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 18
- name: Restore Beef repository
id: beef-repo-restore
uses: actions/cache/restore@v4
with:
path: |
Beef
key: BeefRepository
- name: Pull Beef changes
if: steps.beef-repo-restore.outputs.cache-hit == 'true'
run: |
git -C Beef pull
- name: Clone Beef repository
if: steps.beef-repo-restore.outputs.cache-hit != 'true'
run: |
git clone https://code.booklordofthe.dev/Extern/Beef Beef
- name: Run build.sh
run: |
Beef/bin/build.sh
- name: Cache repository
if: steps.restore-beef-repository.outputs.cache-hit != 'true'
id: beef-repo-save
uses: actions/cache/save@v4
with:
path: |
Beef
key: BeefRepository
- name: Create build artifact
run: |
mkdir artifact
mkdir artifact/BeefBuild
cp -Lr Beef/IDE/dist artifact/BeefBuild/bin
cp -Lr Beef/BeefLibs artifact/BeefBuild/BeefLibs
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: BeefBuild
path: artifact
Package and Upload:
steps:
- name: Setup directories
run: |
mkdir BeefDeb
mkdir BeefDeb/DEBIAN
mkdir BeefDeb/opt
mkdir BeefDeb/opt/BeefBuild
mkdir BeefDeb/usr
mkdir BeefDeb/usr/bin
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: BeefBuild
path: BeefDeb/opt/BeefBuild
- name: Create control file
run: |
cat > BeefDeb/DEBIAN/control << EOF
Package: beefbuild
Version: 0.43.5.${{env.GITHUB_RUN_NUMBER}}
Section: Beef
Priority: optional
Architecture: amd64
Homepage: https://www.beeflang.org/
Maintainer: Booklordofthedings <Booklordofthedings@tutanota.com>
Description: A compiler for beef. Use BeefBuild -help to get more information
EOF
- name: Create run file
run: |
cat > BeefDeb/usr/bin/BeefBuild << EOF
#! /bin/bash
exec /opt/BeefBuild/bin/BeefBuild "$@"
EOF
chmod 755 BeefDeb/usr/bin/BeefBuild
- name: Build deb package
run: |
dpkg-deb -b BeefDeb
- name: Upload deb package
run: |
curl --user Booklordofthedings:${{ secrets.PACKAGE_TOKEN }} \
--upload-file BeefDeb.deb \
https://code.booklordofthe.dev/api/packages/Extern/debian/pool/bookworm/main/upload