diff --git a/.github/cosmo/build b/.github/cosmo/build new file mode 100755 index 0000000..05c43dc --- /dev/null +++ b/.github/cosmo/build @@ -0,0 +1,21 @@ +#!/bin/sh +set -eux + +SAMU_DIR="$(pwd)" +# download cosmocc +cd /sc +wget https://github.com/jart/cosmopolitan/releases/download/3.3.3/cosmocc-3.3.3.zip +mkdir -p cosmocc +cd cosmocc +unzip ../cosmocc-3.3.3.zip + +# register +cd /sc/cosmocc +sudo cp ./bin/ape-x86_64.elf /usr/bin/ape +sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" + +# build fat binary +COSMO_DIR="/sc/cosmocc" +cd "$SAMU_DIR" +COSMOCC="/sc/cosmocc/bin/cosmocc" +make -j CC="$COSMOCC" diff --git a/.github/workflows/cosmo.yml b/.github/workflows/cosmo.yml new file mode 100644 index 0000000..36bec2f --- /dev/null +++ b/.github/workflows/cosmo.yml @@ -0,0 +1,35 @@ +name: Release + +on: + workflow_dispatch: + release: + types: [created] + push: + tags: + - "*.*" + +permissions: + contents: read + +jobs: + + release-cosmo: + permissions: + contents: write # for softprops/action-gh-release to create GitHub release + name: Build release binaries for Cosmo + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@master + - name: create build folder + run: | + sudo mkdir -p /sc + sudo chmod -R 0777 /sc + - name: build APE binary of samurai + run: bash ./.github/cosmo/build + - name: push binary to github + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + samu