diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fb8790..c96c6c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,6 @@ jobs: - name: Build run: | docker run --rm -v $PWD:/app -w /app ghcr.io/panda-re/embedded-toolchains:latest /app/build.sh - tar -czvf console-latest.tar.gz build - name: Save package uses: actions/upload-artifact@v3 @@ -50,8 +49,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./console-latest.tar.gz - asset_name: console-latest.tar.gz + asset_path: ./console.tar.gz + asset_name: console.tar.gz asset_content_type: application/gzip - name: Publish release @@ -59,4 +58,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - id: ${{ steps.create_release.outputs.id }} \ No newline at end of file + id: ${{ steps.create_release.outputs.id }} diff --git a/build.sh b/build.sh index 51967de..e1c3f7b 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,51 @@ #!/bin/bash TARGETLIST=(x86_64-linux-gnu i686-linux-musl mipseb-linux-musl mipsel-linux-musl arm-linux-musleabi aarch64-linux-musl mips64eb-linux-musl mips64el-linux-musl) -# rm -rf build -mkdir -p build -BUILDDIR=`realpath build` -echo "Built by $USER on $HOSTNAME at `date`" > build/buildinfo.txt + +BUILDDIR=build +mkdir -p $BUILDDIR +echo "Built by $(whoami) on $HOSTNAME at `date`" > $BUILDDIR/buildinfo.txt + for TARGET in "${TARGETLIST[@]}"; do echo "Building for $TARGET" CC=$TARGET-gcc ARCH=$TARGET BUILD=$BUILDDIR make -j`nproc` all -done \ No newline at end of file +done + +OUT=console +mkdir -p $OUT + +for x in $BUILDDIR/console-*; do + ARCH=$(basename $x | cut -d- -f2-) + case $ARCH in + x86_64-linux-gnu) + SUFFIX="x86_64" + ;; + i686-linux-musl) + SUFFIX="x86" + ;; + arm-linux-musleabi) + SUFFIX="armel" + ;; + aarch64-linux-musl) + SUFFIX="aarch64" + ;; + mipsel-linux-musl) + SUFFIX="mipsel" + ;; + mipseb-linux-musl) + SUFFIX="mipseb" + ;; + mips64eb-linux-musl) + SUFFIX="mips64eb" + ;; + mips64el-linux-musl) + SUFFIX="mips64el" + ;; + *) + echo "Unsupported architecture: $ARCH" + exit 1 + ;; + esac + cp $x ${OUT}/console.${SUFFIX} +done + +tar cvzf console.tar.gz ${OUT}