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

119 lines
3.1 KiB
YAML
Raw Normal View History

2024-09-11 23:46:57 +02:00
on:
workflow_dispatch:
2024-09-11 23:53:00 +02:00
schedule:
- cron: '0 12 * * *'
2024-09-11 23:46:57 +02:00
jobs:
Build:
steps:
2024-09-12 00:25:19 +02:00
2024-09-11 23:46:57 +02:00
- name: Install apt packages
run: |
apt update
2024-09-12 00:25:19 +02:00
apt install git cmake software-properties-common --yes
2024-09-11 23:46:57 +02:00
- name: Add llvm package
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 18
2024-09-12 00:25:19 +02:00
- name: Restore Beef repository
2024-09-12 00:34:55 +02:00
id: beef-repo-restore
2024-09-12 00:25:19 +02:00
uses: actions/cache/restore@v4
with:
path: |
2024-09-12 10:03:45 +02:00
Beef
2024-09-12 00:25:19 +02:00
key: BeefRepository
2024-09-12 00:33:22 +02:00
- name: Pull Beef changes
2024-09-12 00:34:55 +02:00
if: steps.beef-repo-restore.outputs.cache-hit == 'true'
2024-09-12 00:25:19 +02:00
run: |
git -C Beef pull
2024-09-11 23:46:57 +02:00
- name: Clone Beef repository
2024-09-12 14:02:15 +02:00
if: steps.beef-repo-restore.outputs.cache-hit != 'true'
2024-09-12 00:28:06 +02:00
run: |
git clone https://code.booklordofthe.dev/Extern/Beef Beef
2024-09-12 00:25:19 +02:00
2024-09-11 23:46:57 +02:00
- name: Run build.sh
run: |
2024-09-12 00:25:19 +02:00
Beef/bin/build.sh
- name: Cache repository
2024-09-12 10:45:10 +02:00
if: steps.restore-beef-repository.outputs.cache-hit != 'true'
2024-09-12 00:34:55 +02:00
id: beef-repo-save
2024-09-12 00:25:19 +02:00
uses: actions/cache/save@v4
with:
path: |
2024-09-12 10:03:45 +02:00
Beef
2024-09-12 00:25:19 +02:00
key: BeefRepository
2024-09-12 16:54:17 +02:00
2024-09-12 16:53:04 +02:00
- name: Create build artifact
run: |
mkdir artifact
2024-09-14 00:55:15 +02:00
mkdir artifact/BeefBuild
2024-09-12 17:29:08 +02:00
cp -Lr Beef/IDE/dist artifact/BeefBuild/bin
cp -Lr Beef/BeefLibs artifact/BeefBuild/BeefLibs
2024-09-12 16:54:17 +02:00
- name: Upload build artifact
2024-09-12 17:06:27 +02:00
uses: actions/upload-artifact@v3
2024-09-12 16:54:17 +02:00
with:
name: BeefBuild
path: artifact
2024-09-12 17:51:07 +02:00
2024-09-14 01:16:55 +02:00
Package and Upload:
2024-09-12 17:51:07 +02:00
steps:
2024-09-12 20:53:21 +02:00
- 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
2024-09-14 02:25:52 +02:00
path: BeefDeb/opt
2024-09-12 20:53:21 +02:00
- name: Create control file
run: |
cat > BeefDeb/DEBIAN/control << EOF
Package: beefbuild
2024-09-14 00:55:15 +02:00
Version: 0.43.5.${{env.GITHUB_RUN_NUMBER}}
2024-09-12 20:53:21 +02:00
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
2024-09-14 00:55:15 +02:00
- 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
2024-09-14 02:30:02 +02:00
- name: Fix config file
run: |
2024-09-14 09:04:53 +02:00
sed -i -e 's,"../../BeefLibs","../BeefLibs",g' /opt/BeefBuild/bin/BeefConfig.toml
2024-09-14 02:30:02 +02:00
2024-09-14 00:55:15 +02:00
- name: Build deb package
run: |
dpkg-deb -b BeefDeb
2024-09-14 01:16:12 +02:00
- 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
2024-09-12 17:51:07 +02:00